So the best output compression combination I've found so far (for IIS 7 & 8) is to:
-
Enable dynamic compression via IIS to handle all desired compression algorithms (gzip, deflate, br, etc.)
- Fine-tune both the dynamic and static compression settings via the applicationHost.config file (see the httpCompression excerpt below)
- Enable both output compression for pages and resources via Kentico's Settings
- Define the desired encoding priority order in our custom web applications, e.g. deflate > gzip (explained here)
This way:
- We dynamically compress resources that Kentico cannot (custom handlers, System level handlers like WebResource.axd, etc.)
- We provide fallback compression algorithms for browsers that do not support deflate
- We override the outdated safe static compression default settings that IIS provides at install
- For our custom output, we can override the questionable way IIS 7+ prioritizes which encoding to use (left-to-right in the Request Header, given no qvalues, which I can't find specified in any RFC version – e.g. see this section in 7231)
Has anyone found a better combination?
Here are the httpCompression settings I'm using in my applicationHost.config file:
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" minFileSizeForComp="1024" staticCompressionIgnoreHitFrequency="true">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" dynamicCompressionLevel="4" />
<scheme name="deflate" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" dynamicCompressionLevel="4" />
<dynamicTypes>
<clear />
<add enabled="true" mimeType="text/*" />
<add enabled="true" mimeType="message/*" />
<add enabled="true" mimeType="application/javascript*" />
<add enabled="true" mimeType="application/json*" />
<add enabled="true" mimeType="application/x-javascript*" />
<add enabled="false" mimeType="*/*" />
</dynamicTypes>
<staticTypes>
<clear />
<add enabled="true" mimeType="text/*" />
<add enabled="true" mimeType="message/*" />
<add enabled="true" mimeType="application/javascript*" />
<add enabled="true" mimeType="application/json*" />
<add enabled="true" mimeType="*/*+xml*" />
<add enabled="true" mimeType="application/vnd.ms-fontobject*" />
<add enabled="true" mimeType="font/otf*" />
<add enabled="true" mimeType="application/octet-stream*" />
<add enabled="false" mimeType="*/*" />
</staticTypes>
</httpCompression>
Any feedback is appreciated!