You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nick Kochakian <ni...@nerdshack.com> on 2006/11/03 17:49:24 UTC

[users@httpd] Deflate configuration problem

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
    </IfModule>
</Location>

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
        </IfModule>

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 
variables.

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 
text/something.

Thanks


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org