Posted on:
Categories: SharePoint
Description:

  Cache-Control Settings for SharePoint 2010

By default SharePoint will instruct a client computer to cache content from the _layouts folder on the SharePoint server for 31536000 seconds or 365 days. This can be an issue in staging environments in which CSS and JavaScript files are being changed on a regular basis because CSS and JavaScript files are typically stored in the _layouts folder. There are ways to force a browser to fetch new instances of CSS and JavaScript files (e.g. ctrl + f5); however, it would be ideal if we could use a solution that would allow the browser to fetch new instances of these files without manual user intervention.

We can adjust the Cache-Control settings in IIS so that content sent from the _layouts folder will expire sooner than it's default configuration.

In IIS select the _layouts folder within the site that you want to configure. Select ‘HTTP Reponse Headers’

LayoutsFolderInIIS


Select ‘Set Common Headers’

SetHTTPResponseHeaders



You will see that the default configuration is to have Web content expire after 365 days

DefaultConfiguration


 

Change the ‘Expire Web Content’ option to a value that works with your testing procedures. In this example we have set ‘Expire Web Content’ to 1 hour. So clients will now fetch new versions of any files that are stored in the _layouts folder (e.g. CSS, JavaScript files) after 1 hour.

ConfigureHTTPResponseHeaders