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