Aghh the joys of working with websites..

One step forward another step back.

Scenario

You have zipped files available for download from your site, blog, CMS etc.  When you test the download process our in IE you get an error:

The Compressed (zipped) Folder is invalid or corrupted.


UK Magento e-commerce hosting
However, when you test the download with Firefox or Chrome all works fine. You may even be able to open the file via 7zip or Winrar. However, normal people (non-geeks) will not be able to enjoy your amazing zipped files. This can be especially irritating if you are trying to sell downloadable files via Magento or similar. The problem is probably related to the way in which you have told apache to gzip your site. Check to make sure that you (or your software package) have not applied the following in either .htaccess or httpd.conf

SetOutputFilter DEFLATE

This essentially tells apache to compress all files being sent to the browser. Fine unless you have already compressed a file. This double compression clearly damages the files in transit leading to the problem above. I have yet to figure out why FF or chrome seem to compensate for this. Either way you need to be more specific in how you tell apache to compress what.

Something like this should be used

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
AddOutputFilterByType DEFLATE application/javascript application/x-javascript
#AddOutputFilterByType DEFLATE application/x-httpd-php

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:pdf|doc)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:avi|mov|mp3|mp4|rm)$ no-gzip dont-vary

The top block explicitly tell the server what type of files to compress. The middle block targets the browsers. The final block will exclude php generated media formats which again do not need to compressed twice.

Related Posts

  1. Embedded images not showing in gmail for Internet Explorer 8