Skip to content

Instantly share code, notes, and snippets.

@tonydjukic
Last active October 20, 2016 18:08
Show Gist options
  • Save tonydjukic/7912660dae5a3e5f84ce79fe07096c86 to your computer and use it in GitHub Desktop.
Save tonydjukic/7912660dae5a3e5f84ce79fe07096c86 to your computer and use it in GitHub Desktop.
Settings to add to Windows Azure IIS web.config file to enable GZIP Compression & Browser Caching
<!-- ENABLE GZIP COMPRESSION, BROWSER CACHING & CORRECTING .woff FONT 404 ERRORS ON IIS SERVERS -->
<!-- FOR COMPRESSION -->
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
<httpCompression>
<dynamicTypes>
<clear />
<add enabled="true" mimeType="text/*"/>
<add enabled="true" mimeType="message/*"/>
<add enabled="true" mimeType="application/x-javascript"/>
<add enabled="true" mimeType="application/javascript"/>
<add enabled="true" mimeType="application/json"/>
<add enabled="false" mimeType="*/*"/>
<add enabled="true" mimeType="application/atom+xml"/>
<add enabled="true" mimeType="application/atom+xml;charset=utf-8"/>
</dynamicTypes>
<staticTypes>
<clear />
<add enabled="true" mimeType="text/*"/>
<add enabled="true" mimeType="message/*"/>
<add enabled="true" mimeType="application/javascript"/>
<add enabled="true" mimeType="application/atom+xml"/>
<add enabled="true" mimeType="application/xaml+xml"/>
<add enabled="true" mimeType="application/json"/>
<add enabled="false" mimeType="*/*"/>
</staticTypes>
</httpCompression>
</system.webServer>
<!-- BROWSER CACHING -->
<system.webServer>
<staticContent>
<clientCache cacheControlMaxAge="28.00:00:00" cacheControlMode="UseMaxAge"/>
</staticContent>
<caching>
<profiles>
<add extension=".php" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:01:00:00" />
<add extension=".ttf" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".gif" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".jpg" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".png" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".js" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".css" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
</profiles>
</caching>
</system.webServer>
<!-- FIX .woff FONT 404 NOT FOUND ISSUE -->
<system.webServer>
<staticContent>
<remove fileExtension=".woff" /> <!-- In case IIS already has this mime type -->
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
</system.webServer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment