IIS6 compressing static files, but not JSON requests
- by user500038
I have IIS6 compression setup, and static content is being compressed correctly as per Coding Horror. Example of a static file:
   Response Headers
    Content-Length 55513
    Content-Type application/x-javascript
    Content-Encoding gzip
    Last-Modified Mon, 20 Dec 2010 15:31:58 GMT
    Accept-Ranges bytes
    Vary Accept-Encoding
    Server Microsoft-IIS/6.0
    X-Powered-By ASP.NET
    Date Wed, 29 Dec 2010 16:37:23 GMT
    Request Headers
    Accept */*
    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
As you can see, the response is correctly compressed. However with a JSON call you'll see the request with the gzip parameter correctly set:
Accept application/json, text/javascript, */*; q=0.01
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
X-Requested-With XMLHttpRequest
Then for the response:
Cache-Control private
Content-Length 6811
Content-Type application/json; charset=utf-8
Server Microsoft-IIS/6.0
X-Powered-By ASP.NET
X-AspNet-Version 2.0.50727
X-AspNetMvc-Version 2.0
No gzip! I found this article by Rick Stahl, which outlines how to compress in your code, but I'd like IIS to handle this. Is this possible with IIS6?