Why doesn't gzip compression work on IIS 8.5?

I can't seem to get gzip compression to work on IIS 8.5 on a Server 2012 R2 machine. I did some research and followed the instructions given in these posts:

Here is the relevant section of my configuration:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" staticCompressionIgnoreHitFrequency="true">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
    <!-- I have read that dynamic compression increases server CPU load.
    <dynamicTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/javascript" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
    </dynamicTypes>
    -->
    <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
    </staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />

      

Also, in IIS, I set the compression for the application to be larger than 256 bytes. And I did iisreset.

However, I don't see the compression mentioned in my developer console in Chrome or IE, and PageSpeed ​​is still telling me to compress stuff. What simple step did I miss?

+3


source to share


1 answer


It's hard to understand what's going on. Imagine that you have completed all the IIS settings correctly.

  • To check if the compression is working fine or not how you access the website. for example If you are using the FQDN www.example.com try using the localhost url. This will ensure that your IIS settings are correct.
  • If localhost is working fine and your FQDN is not working, then the problem may be on the network. For compression to work, the browser needs to send the request header accept-encoding:gzip, deflate

    . many times your proxy server or load balancer may truncate this header, and this header may not reach the IIS server. Therefore, IIS will never compress if all settings are correct.


To check what is happening for the request and why IIS was not compressing the request, you can do the following.

  • make sure you have an established failure tracing requests .
  • Customize the definition of a failed request
    • Navigating to Failed Request Tracking Modules
    • Click "Add" in the sidebar Failed to trace request
    • Include All content and status 200-999
    • And complete the setup.
    • Now reproduce the issue and you will get the traces recorded in the C: \ inetpub \ logs \ FailedReqLogFiles \ W3SVC directory.
    • Open the trace file (one file will be generated for each request. Open the trace file in IE (make sure the request details match the request you want to test) and go to the compact view Failed to request Compact View tracking
    • Find the compression and also check the reason Dynamic compression failure
+2


source







All Articles