Reduce server traffic by setting the Cache-Control response header in IIS7
Reduce server traffic by setting the Cache-Control response header in IIS7
Problem
Most static files such as images, CSS and Javascript includes seldom change in a production environment. Nevertheless, a web browser checks for a new version of these includes files each time it renders a page. By adding max-age to the HTTP Cache-Control response header, you can instruct the browser, to check for a new version, only if the set interval has passed.
Smartsite automatically adds this response header to CSS and Javascript include files, but IIS doesn't do this by default.
The Scf folder includes only static files which are good candidates for this optimization.
Resolution
You can set the max-age response header for the Scf site folder by executing the following commands:
Copy Code | |
---|---|
%systemroot%\system32\inetsrv\appcmd.exe set config "<sitename>/Scf" /section:system.webServer/staticContent /clientCache.cacheControlMode:UseMaxAge %systemroot%\system32\inetsrv\appcmd.exe set config "<sitename>/Scf" /section:system.webServer/staticContent /clientCache.cacheControlMaxAge:"1.00:00:00" |
Replace <sitename> with the name of the site as displayed in the IIS manager. This sets the interval to check for new versions of the files in the Scf folder to once a day.
If you ever want to remove this repsonse header again, run these commands:
Copy Code | |
---|---|
%systemroot%\system32\inetsrv\appcmd.exe set config "<sitename>/Scf" /section:system.webServer/staticContent /-clientCache.cacheControlMode %systemroot%\system32\inetsrv\appcmd.exe set config "<sitename>/Scf" /section:system.webServer/staticContent /-clientCache.cacheControlMaxAge |
To list the current IIS metabase settings for StaticContent use this command:
Copy Code | |
---|---|
%systemroot%\system32\inetsrv\appcmd.exe list config "<sitename>/Scf" /section:system.webServer/staticContent |
After configuring max-age for the Scf folder, you should see this response header when interrogating the the response for a file in the Scf folder:
Copy Code
HTTP/1.1 200 OK
Cache-Control: max-age=86400
You can als control this setting from the IIS7 Manager:, select the Scf folder, then HTTP Reponse Headers in the Features view and then choose Set Common Headers from the Actions menu.
Note: by changes the path parameter for appcmd, you can override this setting for subfolders and/or individual files.
- Getting Started
- Hardware and software requirements for Smartsite iXperion
- Platform support
- Site Installation
- Smartsite 7 Manager
- iXperion Publication Server
- iXperion tools
- Database Server
- Security
- IIS Configuration
- Asp.Net Configuration
- Outscaling
- WCF
- Smartsite Configuration files
-
Knowledge Base | Installation and Configuration
- Request for the permission of type 'System.Web.AspNetHostingPermission failed.
- ConfigEditor won't start with this message: Method not found: System.Windows.Forms.ToolStripItem.set_ImageIndex(Int32)
- SecurityException while installing the performance counters.
- Preview error after installing / upgrading to release 1.1
- Purge Items isn't synchronized between cms instances
- How to duplicate the render template mappings from one channel to another
- Automation Error - More Data Available on startup
- Forum Smartlet fails when using Active Directory security on the front-end
- Site fails to start after updating to 1.3 with MissingMethodException
- The PUB engine won't start due to the following error: Could not load type 'System.DateTimeOffset' Exception
- Outscaling keeps trying to send failed events
- Error Reference
- EmptySix site
- Smartsite iXperion Release 1.3 Installation manual
- Smartsite iXperion Requirements - v3.6
- Implementatiehandleiding Active Directory Koppeling of LDAP Smartsite iXperion v1.1.3
- Installatiehandleiding iXperion 1.3 en hoger Win 2008 32bit-v1.4
- Installatiehandleiding iXperion 1.3 en hoger Win 2008 64bit-v1.4
- Installatiehandleiding iXperion Word Import - Word 2010 setup voor x64- v1.0
- Installatiehandleiding Oracle client iXperion 1.3 Windows 2008 R2 64bit- v1.0.1
- Installatiehandleiding Smartsite iXperion SMI 2.0 - v1.0.3