Need help with some IIS7 web.config compression settings

compressiongzipiis-7web.config

I'm trying to configure my IIS7 compression settings in my web.config file. I'm trying to enable HTTP 1.0 requests to be gzip.

MSDN has all the info about it here.

Is it possible to have this config info in my own website's web.config file? Or do i need to set it at an application level? Currently, I have that code in my web.config…

<system.webServer>
    <urlCompression 
        doDynamicCompression="true" 
        dynamicCompressionBeforeCache="true" />
    <httpCompression 
        cacheControlHeader="max-age=86400" 
        noCompressionForHttp10="False" 
        noCompressionForProxies="False" 
        sendCacheHeaders="true" />

    ... other stuff snipped ...

</system.webServer>

It's not working 🙁 HTTP 1.1 requests are getting compressed, just not 1.0.

That MSDN page above says that it can be used in :-

  • Machine.config
  • ApplicationHost.config
  • Root application Web.config
  • Application Web.config
  • Directory Web.config

So, can we set these settings on a per-website-basis, programatically in a web.config file? (this is an Application Web.config file…) What have i done wrong?

cheers 🙂

EDIT: I was asked how i know HTTP1.0 is not getting compressed. I'm using the Failed Request Tracing Rules, which reports back:-

DYNAMIC_COMPRESSION_START
DYNAMIC_COMPRESSION_NOT_SUCESS
    Reason: 3
    Reason: NO_COMPRESSION_10
DYNAMIC_COMPRESSION_END

Best Answer

Pay close attention to the fact that the IIS 7.x web.config setting of

noCompressionForProxies="false"

Is not honored at the web.config level. It must be set in C:\Windows\System32\inetsrv\config\ApplicationHost.config like so:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" noCompressionForProxies="False">

Be sure and perform an IIS reset after changing the setting.

A request is determined to be from a proxy by IIS if the client's web request has the HTTP "Via" header like so:

Via: 1.1 foo