Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is gzip compression with Internet Explorer not working?

My site is gzipped compressed, and it doesn't load properly in IE. It works fine in FF/Chrome, but in IE, the only thing that pops up is a box asking to download the .gz file which contains the html document for the page.

Is this normal? Do I have to turn off gzip?

like image 375
chris Avatar asked Aug 06 '09 22:08

chris


People also ask

Why is gzip not working?

The other reason Gzip might not be working is that you have extremely large files on your site. Older version of Gzip have a file size limit of something like 2GB. Any file larger than that will not be compressed using the Gzip algorithm.

Does gzip work on all browsers?

gzip compressionThis HTTP header is supported in effectively all browsers.

How can you tell if gzip compression is enabled or not in your browser?

Double click on the file and select headers. Under 'Response headers' you are looking for the 'Connection-Encoding' field, it will say gzip if it is enabled.


2 Answers

Are you sending the correct headers?

You need to send the

Content-Encoding: gzip

header for IE to understand that it is gzipped (Firefox, et al are smart enough to detect this automatically - even though they shouldn't!)

In PHP, you can do this using:-

header('Content-Encoding: gzip');
like image 181
Mez Avatar answered Sep 30 '22 17:09

Mez


One thing to add - you should turn off gzip compression for IE6 pre-SP2. Before SP2, IE6 doesn't always read and cache gzipped content properly and you end up with mangled code.

You can identify an IE6 SP2 install by looking for "SV1" in the user-agent string.

like image 32
Pat Avatar answered Sep 30 '22 19:09

Pat