Windows Server 2012 R2 comes with IIS 8.5, and in this release an issue has been found in relation to the Dynamic Compression module. The module sets the “Vary” header which is used to specify caching properties that the browser uses to determine whether the response should be cached or not.
In IIS 8.0 and earlier, the Dynamic Compression module was overwriting the Vary header with the value “Accept-Encoding”, and as it happens this is the correct value to ensure that dynamic content is correctly cached – but – according to IIS it should be appending this value to the existing value and not overwriting it.
As it happens, this was supposed to be fixed in IIS 8.5 but the fix appears to be broken. In IIS 8.5 (which ships with Windows Server 2012 R2) the Vary header is being set to “*” and the “Accept-Encoding” from the Dynamic Compression module is not appended. The result of this is that no dynamic content is being cached by the browser.
Thankfully there is an easy workaround in IIS 8.5 for this:
1. Select an IIS site, and go to Configuration Editor.
2. Select system.web/caching/outputCache section, then set the omitVaryStar property to true
Setting this value results in the Vary header being returned with a value of “Accept-Encoding” and the browser then caches the dynamic content.