Tuesday, October 5, 2010

IE6 gzip problem

Once in a time, IE6 has been successful that people would make it as a default browser. It has been recognized among the organizations. But, now we have a lot more choices like Firefox, Chrome and Safari. Although the speed of hardware peripheral is faster than ever, the network speed is still varying from area to area. For saving bandwidth and server loading, modern browsers support compression feature which allows the compressed content transferred over the network and then have it decompressed for processing. It's been in doubt that IE6 can truly support this feature. There are criticism over IE6 gzip handling among the forum users. Most developers would just skip it to get most widely acceptance among the users. Indeed, not just IE, older browsers might not support gzip content.

The thing is that we can isolate those problematic browsers when incorporating this good feature. Apache server can be configured to skip annoying bugs over gzip in this way:


# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary


IE6 masquerades itself as Mozilla 4 so it is okay to put in no-gzip parameter for this kind of browsers.

Proxy server is also part of the causes when it starts to change header information for User-Agent. From Apache's manual, you will find this:


The mod_deflate module sends a Vary: Accept-Encoding HTTP response header to alert proxies that a cached response should be sent only to clients that send the appropriate Accept-Encoding request header. This prevents compressed content from being sent to a client that will not understand it.
If you use some special exclusions dependent on, for example, the User-Agent header, you must manually configure an addition to the Vary header to alert proxies of the additional restrictions. For example, in a typical configuration where the addition of the DEFLATE filter depends on the User-Agent, you should add:
Header append Vary User-Agent


All these measures aim at keeping the HTTP content delivery smooth enough and unchanged throughout the proxy servers.

No comments:

Post a Comment