When running a Windows Azure website you may run into a problem I came across with gzipping content. By default Azure websites are very easy to set up and have little maintenance cost. Most of the performance features are turned on by default with one exception. SVG images seem to not gzip on website instances. Azure Websites seem to also ignore the web config overrides for this as well.
Unfortunately the way to turn this on is to use Web Roles. I did not want to deal with that hassle so I created a controller to handle incoming SVG requests as recommended from these two posts, Stack Overflow and Asp Weblogs.
Thanks to David Ebbo (@davidebbo) he pointed me in the right direction in making a better solution. it turns out you can get gzip to turn on for SVG with the web config. The solution is below, as well as the comments.
<configuration> <system.webServer> <staticContent> <mimeMap fileExtension=".svg" mimeType="image/svg+xml"/> </staticContent> <httpCompression> <staticTypes> <remove mimeType="*/*"/> <add mimeType="image/svg+xml" enabled="true"/> <add mimeType="*/*" enabled="false"/> </staticTypes> </httpCompression> </system.webServer> </configuration>
The key part I was previously missing was the
<remove mimetype="*/*" />. If you read the comments by David it seems that this will be fixed and turned on by default on the next Azure update.