Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
What are the full response headers? –  Shane Madden Feb 27 '12 at 19:13
    
The request headers would also be helpful. –  devicenull Feb 28 '12 at 4:02
    
I have amended the question since the headers are in fact different and included them in the question. Thanks for your help in advance. –  WebweaverD Feb 28 '12 at 16:03
add comment

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
Just an observation, but the problem does seem to be related to your server (and not the browser). It appears that your server is processing the User Agent string (e.g. using the BrowserMatch directive) and responding differently based on it. A simple proof: install a user-agent switching extension in Firefox, and change your user agent string to one matching IE - the file is delivered uncompressed (according to Firebug), revert to the default user agent string, and the file is delivered compressed - seems to potentially rule out the browser itself as the culprit. –  cyberx86 Mar 1 '12 at 17:04
    
Thank you for the info cyber, I will look into it - I made sure to remove the IE browser matching in my htaccess so if this is happening it must be part of the deflate/gzip config –  WebweaverD Mar 2 '12 at 15:23
    
Ok, things get stranger.... Server log also says the files are being compressed. –  WebweaverD Mar 7 '12 at 13:57
    
Looking through fiddler it also appears that the files are in fact being compressed through both browsers, but being reported incorrectly through IE dev tools. Also with content encoding header missing in IE –  WebweaverD Mar 10 '12 at 16:19
    
I might suggest that you want to reopen this question. Update it with your new findings and as much of your Apache config as possible (just in case there is a seemingly unrelated line in there causing problems); the packet trace run on your server (tcpdump) and testing machine (wireshark); server logs (and figure-out the 'Vary: User-agent' header you are returning). Also, see if you can replicate the problem on a clean virtual machine (e.g. VirtualBox) - install whatever operating system your server uses, and Apache - with your config - connect to it and see if you can replicate the problem. –  cyberx86 Mar 10 '12 at 21:53
add comment

Not an 'answer' per-se, but mod_gzip works great for me (IE9 too). My configuration:

<IfModule gzip_module>
    mod_gzip_on Yes

    mod_gzip_item_include mime text/.*
    mod_gzip_item_include mime application/xm.*
    mod_gzip_item_include mime application/javascript
    mod_gzip_item_include mime image/svg.*

    mod_gzip_dechunk Yes
</IfModule>

Deflate and GZip are almost the same thing, gzip is technically slower, though on modern computers the difference can be safely ignored at the client end, and on the server end if you're caching the responses (not possible with dynamically generated pages).

share|improve this answer
    
I would gladly accept gzip as a solutions and my hosting provider says it is supported on their servers but when I tried the code above it doesn't compress in firefox or Internet explorer –  WebweaverD Feb 28 '12 at 17:13
    
Depending on how the module was compiled the IfModule statement may need to be modified or removed. –  Chris S Feb 28 '12 at 18:05
    
As I said I am new to this and I have looked through countless pages on the net with slightly differend mod rewrites on them.... nothing seems to work. I found something suggesting I run phpinfo(); to check the module is installed. I have done this and can find no refernce to gzip module. I can clearly see the zlib deflate and a zip module. Would someone be kind enough to take a look and make sure I'm not chasing magic beans here. www.alexchapman.co.uk/info –  WebweaverD Feb 28 '12 at 21:44
    
Unfortunately the PHP info page has almost nothing to do with Apache's configuration and modules (somewhat poor choice of names, I know). If you have Apache's mod_status installed and enabled (which is rare by default) you can put SetHandler server-status in a .htaccess file and the default document of that directory will show a status page of Apache's configuration and modules. If mod_gzip is installed you should be able to simply remove the first and last line of my code above (the parts with angle brackets). –  Chris S Feb 28 '12 at 21:47
    
HEy Chris ,really appreciate your help, I have tried both suggestions. If I remove the if module from the code the site produces an internal server error. I tried your set handler suggestion and got something back, unfortunately I have no info about installed modules, just a list of hosted sites, presumably because I am on a shared hosting plan: www.alexchapman.co.uk/i. –  WebweaverD Feb 29 '12 at 15:43
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.