0

I have IIS 7.5 setup to use gzip compression on both static and dynamic content. By inspecting the "IIS Temporary Compressed Files" folder, I have verified that it is indeed compressing all of the static MIME types I have defined in my config. I also forced a Failed Request Trace and found the compression is being successfully executed, with no errors, when the request comes in (both static and dynamic).

However, the response that IIS sends back to the browser is uncompressed. The size of the response is the same, and there is no "Content-Encoded: gzip" header in the response.

My IIS config:

    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" minFileSizeForComp="1" noCompressionForHttp10="false" noCompressionForProxies="false">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
        <dynamicTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/json" enabled="true" />
            <add mimeType="application/json; charset=utf-8" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="application/x-javascript; charset=utf-8" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </dynamicTypes>
        <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/atom+xml" enabled="true" />
            <add mimeType="application/xaml+xml" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="application/x-javascript; charset=utf-8" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </staticTypes>
    </httpCompression>
    ...
    <urlCompression doStaticCompression="true" doDynamicCompression="true" />
    ...
    <serverRuntime frequentHitThreshold="1" />

Sample request (example is dynamic, but same deal with static types too):

    Accept:application/json, text/plain, */*
    Accept-Encoding:gzip, deflate
    Accept-Language:en-US,en;q=0.8
    Cache-Control:no-cache
    Connection:keep-alive
    Content-Length:0
    Cookie:ASP.NET_SessionId=...
    Host:...
    Origin:...
    Pragma:no-cache
    Referer:...
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36

Sample response:

    Cache-Control:private
    Content-Type:application/json; charset=utf-8
    Date:Tue, 29 Sep 2015 21:37:28 GMT
    Server:Microsoft-IIS/7.5
    Set-Cookie:.ASPXAUTH=...
    Transfer-Encoding:chunked
    Vary:Accept-Encoding
    X-AspNet-Version:4.0.30319
    X-AspNetMvc-Version:5.0
    X-Powered-By:ASP.NET

Again, I have verified that it is compressing successfully, it's just not sending the compressed data in the response for some reason.

  • I'm pretty sure this works if the client includes in the request: Accept-Encoding: gzip. Also, your sample request isn't a request. – Greg Askew Sep 29 '15 at 23:39
  • Oops, I accidentally posted the response headers twice. Fixed the post with the actual request headers. As you can see it is sending "Accept-Encoding: gzip" and it's still not working. – David Schaffer Oct 01 '15 at 01:59

0 Answers0