5

I've turned on dynamic content compression in IIS 7, but Fiddler is showing that my dynamic pages are still being served without content-encoding: gzip.

Static content compression is working fine on the same servers.

Not sure if it matters but most of the dynamic pages are coldfusion pages (Coldfusion is configured as an ISAPI extension) and we're also using the IIS URL rewriting module.

This is from my applicationhost.config.

        <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
            <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
            <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 doDynamicCompression="true" />

Here's a sample request:

GET / HTTP/1.1
Host: web5.example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive

and response header:

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Server: Microsoft-IIS/7.0
...
Date: Mon, 22 Feb 2010 20:59:36 GMT

4 Answers 4

1

You can follow the troubleshooting steps mentioned here.. HTTP COMPRESSION in IIS 6 and IIS 7 using Service Account

1
  • I don't think this is the issue as the Application Pool is running under the default NetworkService account
    – davidcl
    Feb 22, 2010 at 21:18
1

"Content-Endcoding: chunked" should never appear in a server response. "Chunked" is a separate part of the HTTP spec entirely, "Transfer-Encoding". You should be looking for "Content-Encoding: gzip", potentially in addition to "Transfer-Encoding: chunked". Here is an example from Google's home page:

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Date: Wed, 17 Feb 2010 13:43:22 GMT
Expires: Wed, 17 Feb 2010 13:43:22 GMT
Cache-Control: private, must-revalidate, max-age=0
Last-Modified: Wed, 17 Feb 2010 13:43:22 GMT
Server: igfe
Transfer-Encoding: chunked
Content-Encoding: gzip

Now, as far as debugging your issue goes, IIS7 compresses based on content-type. So when it sees "Content-Type: text/html", it compresses the page. So first, make sure your scripts are returning a content-type that IIS sees as compressible (text/*).

Also, IIS will not compress the page by default for an HTTP/1.0 request (used by some proxies such as Squid) or headers which indicate that the request came from a proxy server (Via: or X-Forwarded-For:). This is a conservative default to deal with the large number of older proxies out there that don't handle compressed HTTP content properly. You can override this behavior by editing IIS configuration files (either at the server or site level).

Finally, make sure your client is sending "Accept-Encoding: gzip" headers on the request. If it is a standard browser, it will by default, but if you are using wget or some other tool it may not. You can use Fiddler to see the entire HTTP conversation, including headers and data.

3
  • You're right, I confused content-encoding and transfer-encoding. My mistake. Still, everything else looks good and I'm not getting compression. I'll update the question.
    – davidcl
    Feb 22, 2010 at 21:04
  • Does it work when you remove the URL rewriting module from your settings? How is the IIS-to-coludfusion proxying integrated (an ISAPI extension)? We use IIS compression with ISAPI-based applications (the Apache Tomcat connector and others) and IIS handles the dynamic compression just fine.
    – rmalayter
    Mar 22, 2010 at 12:42
  • Sorry, missed this comment. Yes, Coldfusion is a configured as an ISAPI extension-- the configuration is very similar to what you would see with Tomcat or any other Java application server. I'll try removing URL rewriting as a test. Not something I can do in production, unfortunately.
    – davidcl
    May 1, 2010 at 16:11
0

Doing some research I found this that indicates that compression also needs to be enabled on the Coldfusion side when it generates the HTML from a template. I can't find the exact source but if I recall correctly the dynamic compression is targeted at ASP.Net and PHP, but for the latter it still needs to be enabled in the PHP framework as well.

Therefore I am assuming the reason your not seeing the compression happening is because it needs to enabled on the generator side, in this case Coldfusion.

1
  • That's an interesting article. They're using a servlet filter to do the gzip compression, which might be a nice alternate way to handle things if we can't get IIS to handle it. However, I really want IIS to handle the compression, and that should not require any specific configuration within the application server, no matter what language is generating the pages.
    – davidcl
    Mar 1, 2010 at 3:16
0

DO USE NOTEPAD to edit applicationHost.config. I've wasted several hours before understood that my changes made in notepad++ (as well as in Visual Studio 2010 editor!!) aren't applied by IIS.

Alternative way to add additional mimeType into dynamicTypes/staticTypes collection is to use appcmd. "C:\Windows\System32\Inetsrv\Appcmd.exe" set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/javascript',enabled='True']" /commit:apphost

And again: after these changes made - you'll see them only in notepad. Notepad++ (as well as Visual Studio 2010 editor!!) maintains some kind of f*ing alternate reality/storage for applicationHost.config. It shows you his own version of the file (different from the one you see in notepad) even after the file edited in notepad and reopened in np++/VS.

2
  • 1
    I haven't had this problem. Are you sure you are opening the editing app as an Administrator so you have the rights to save the edits over the original file?
    – Mufasa
    Oct 18, 2011 at 14:26
  • Sure, UAC is permamently disabled on my desktop.
    – Sasha
    Nov 13, 2011 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .