Quantcast
Viewing latest article 8
Browse Latest Browse All 10

Need help with some IIS7 web.config compression settings

Image may be NSFW.
Clik here to view.
Question

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 Image may be NSFW.
Clik here to view.
:(
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 Image may be NSFW.
Clik here to view.
:)

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

Image may be NSFW.
Clik here to view.
Answer

How are you testing that HTTP1.0 requests are not being compressed? Could it be that the client that you are using is not telling the server that it can accept a compressed response?

If you can see the headers sent by the client (presented by the test client itself, using Firebug or similar if you are testing in Firefox or IEHTTPHeaders if you are testing in IE, or by sniffing the traffic using an external tool), you should see something like

Accept-Encoding: compress, gzip, deflate

in there somewhere. If the client does not inform the server that it can accept a compressed response then the server will not send one no matter what other settings you have server side.

Another issue could be if you are testing through a proxy server that identified itself as such. In this case the noCompressionForProxies setting might be taking precedence and blocking the possibility of a compressed response.

One thing to note is that some clients and proxys that send HTTP1.0 requests (usually older software) will not correctly handle a compressed response if they get one, so if you do enable compression for responses to HTTP1.0 requests make sure that you test your site/application in all the client/proxy software you expect visitors/users to use. This is less of an issue if you can guarantee your target audience will be using certain software (if for instance the app is for an internal corporate network only) but otherwise there are a lot of combinations to test which is why most servers disable compression for 1.0 requests completely.


Viewing latest article 8
Browse Latest Browse All 10

Trending Articles