Expand Minimize

Server hosting scripts has far future expiration header set

Server hosting scripts has far future expiration header set

CheckId SPF120901
TypeName ServerHostingScriptsHasFarFutureExpirationHeaderSet
Severity CriticalWarning
Type External SharePoint Framework File

The server hosting web part bundles and other scripts, should serve them with the Expires or Cache-Control header set to a far future date. By using the Expires or Cache-Control header you allow scripts to be cached by the web browser. On subsequent requests, web browser will load the script files from its cache and will load the page significantly faster.

Web part files should be cached for a longer period of time such as one year. That will allow users to reuse the previously downloaded scripts and have pages load faster.

Keep in mind, that when using far future expiration headers, whenever the particular script file changes, you will need to change its name in order to have the user see the updates. Unless forced, web browsers will try to reuse the previously cached files without checking if a newer version is available on the server.

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.