Web-server – DEFLATE not working in IE9

apache-2.2deflatemod-deflateweb-server

I posted this on stack overflow but it was suggested I may have more luck here:

I have not used deflate before to encode web pages so this is new ground for me but when I look at nework traffic in ff my all.js file is now 117kb from 427kb so I seem to have it working here. But there is no change in IE9. My response header says Content-Encoding: gzip in FF but not IE9

here is my .htaccess:

<ifModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>

Request Header for all.js in IE9:

   Key  Value
Request GET /all.js HTTP/1.1
Accept  application/javascript, */*;q=0.8
Referer http://www.alexchapman.co.uk/
Accept-Language en-GB
User-Agent  Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Accept-Encoding gzip, deflate
Host    static.alexchapman.co.uk
Connection  Keep-Alive
Cache-Control   no-cache

Response Header for all.js in IE9:

Key Value
Response    HTTP/1.1 200 OK
Date    Tue, 28 Feb 2012 15:53:41 GMT
Server  Apache/2
Last-Modified   Tue, 28 Feb 2012 15:53:40 GMT
Accept-Ranges   bytes
Cache-Control   private
Expires Fri, 02 Mar 2012 03:53:41 GMT
Keep-Alive  timeout=15, max=100
Connection  Keep-Alive
Transfer-Encoding   chunked
Content-Type    text/javascript

Request Header for all.js in Firefox:

Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-gb,en;q=0.5
Cache-Control: no-cache
Connection: keep-alive
Cookie: DELETED - this should not be sent and isnt sent with IE
Host: static.alexchapman.co.uk
Pragma: no-cache
Referer: http://www.alexchapman.co.uk/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2

Response header for all.js in Firefox:

Accept-Ranges: bytes
Cache-Control: private
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type: text/javascript
Date: Tue, 28 Feb 2012 15:55:26 GMT
Expires: Fri, 02 Mar 2012 03:55:26 GMT
Keep-Alive: timeout=15, max=100
Last-Modified: Tue, 28 Feb 2012 15:55:26 GMT
Server: Apache/2
Transfer-Encoding: chunked
Vary: Accept-Encoding

To be clear this is not just happening with all.js – I have used this as an example since it is the biggest file that will benefit from compression. Any suggestions as to what I am doing wrong would be much appreciated.

**********UPDATE************

My hosting provider has got back to me and said that they can confirm that gzip and deflate are both enabled and working on my site, they have said that The issue with Internet Explorer is specific to that browser so I recommend trying compatibility mode as this is not caused by our servers.

I know of a compatability view in IE and this is supposed to help render old sites properly so I dont know what they are on about here and I can confirm this makes no difference to the file compression.

Best Answer

Ithink I have worked out what is happening here. I downloaded Wireshark and checked network traffic through that. Istruggled with it a but but I think I've got it now - would be great if someone can confirm I have done this correctly.

Looking at the file all.js as an example I followed the tcp stream for the request in firefox and IE9. Both said they were using gzip encyption. Interestingly the total size of the conversation was different. Ie9 – 268471 bytes FF-120812 bytes (both smaller than the uncompressed file).

This is approximately the correct file size reported in firebug. But is half the file size reported in IE develolper tools. So it seems that not only is IE worse at gzip but it's developer tool reports incorrectly that it is even worse than it is. If anyone can verify this result or suggest an explanation I will accept their answer.