I have an existing IIS application, and I am trying to get GZIP server side compression to work. The application runs on EPIServer CMS (which I am not that familiar with) - Thinking this could be related to the CMS somehow, as a first step...
I decided to create a new IIS application and this time using Umbraco (another CMS that I am very familiar with) - I have created a basic page with some CSS files and images,
Content-Encoding: gzip
header.
This is what I have tried and checked.
In my web-config file I have added this single line
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="false" />
When the Webconfig has this line I inspect the headers in my browser:
REQUEST HEADERS
Accept: text/css,*/*;q=0.1
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Host: umbracotest.site
Proxy-Connection: keep-alive
Referer: http://umbracotest.site/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36
RESPONSE HEADERS
Accept-Ranges: bytes
Content-Type: text/css
Date: Tue, 01 May 2018 15:09:02 GMT
ETag: "03739d0e978d31:0"
Last-Modified: Tue, 19 Dec 2017 16:52:54 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding
If I change that webconfig line slightly - dynamicCompressionBeforeCache="false" to true - then I just get a whole bunch of symbols in the browser - does that mean anything?
If I add a few more lines in to my webconfig to look like this:
<system.webServer>
<httpCompression>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="image/jpeg" enabled="true" />
<add mimeType="image/png" enabled="true" />
<add mimeType="image/svg" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="image/jpeg" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"
dynamicCompressionLevel="8" />
</httpCompression>
<urlCompression doDynamicCompression="true" doStaticCompression="true"
dynamicCompressionBeforeCache="false" />
headers are still the same.
This is a ASP.net MVC application Any ideas?
So after banging my head on the wall for about 8 hours, I finally got it to work!
After checking everything twice, reading every post I could find on the topic, I came across a comment to a similar question that suggested it could be something to do with my antivirus software. I'm working in an enterprise environment and I don't have the rights to disable it on my local machine. So I deployed the code to our staging server......... and it works.
So in case someone else has this problem, try and disable your anti-virus and see if that makes any difference, it worked for me.