httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kochakian <>
Subject [users@httpd] Deflate configuration problem
Date Fri, 03 Nov 2006 16:49:24 GMT
Hi, I've run into a slight problem while trying to configure mod_deflate 
in Apache 2.0.x. I want to be able to use the content type of a document 
to determine when compression should be enabled. I have this so far:

<Location />
    <IfModule mod_deflate.c>
        # Enable compression for text files
        AddOutputFilterByType DEFLATE text/html text/plain text/xml

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

This is what I want, sort of. I noticed that it was recommended to add 
Vary: User-Agent in the response header for everything that qualifies 
for compression, which in this case would be when the content type of a 
document is of text/something. This could be accomplished by adding

        <IfModule mod_headers.c>
            # Make sure proxies don't deliver the wrong content
            Header append Vary User-Agent env=!dont-vary

after the BrowserMatch statements, but without being able to determine 
when *not* to add Vary: User-Agent, everything sent from the server has 
this header and not just potentially compressed documents. Basically, I 
want to set the environment variable "dont-vary" only when the requested 
document does *not* fall under the set of compressible documents; that 
is if the content type of the document is *not* text/something (as shown 
above), then I don't want to include Vary: User-Agent.

This wouldn't be a problem if SetEnvIf could match against the response 
headers (using something like SetEnvIf Content-Type ..... dont-vary), 
but this function does not have the ability to check the response 
headers, only the request headers and globally defined environment 

Is there another way to solve this problem? To summarize, Apache should 
be configured to disable compression and the insertion of Vary: 
User-Agent if the content type of the requested document isn't 


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message