httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francois PESCE" <>
Subject Re: [PATCH] setenvif filter
Date Wed, 31 May 2006 08:22:26 GMT
I've discussed about a patch for mod_setenvif 2 years ago, and have
coded it at that time, it is successfully used on various host in
production since.

Some example of usage in production:

###  Size Filters
# don't compress items with size lower than 1000 bytes (0-999)
SetEnvIf output_header Content-Length ^[0-9][0-9]?[0-9]?$ no-gzip

###  Don't compress PDF Files
SetEnvIf output_header Content-Type application/pdf no-gzip
SetEnvIf output_header Content-Type application/x-pdf no-gzip
SetEnvIf output_header Content-Type application/acrobat no-gzip
SetEnvIf output_header Content-Type application/vnd.pdf no-gzip
SetEnvIf output_header Content-Type text/pdf no-gzip
SetEnvIf output_header Content-Type text/x-pdf no-gzip

I've attached both patches for 2.0.x and 2.2.x (as some regexp API
changes were done) for those who want to test it on one or the other

Francois Pesce
See also old discussion:

Brian Akins wrote:

> This patch add a filter to mod_setenvif that lets it match against response headers as
well as request headers.  It is probably a horrible implementation, but submitted to encourage
others to think of the idea.
> This changes the configuration to allow another optional field to designate the "mode"
of the match (default is request)
> SetEnvIf response Content-Type text/* is_text=1
> will match against the response header content-type.
> The main purpose of this is to allow configurations such as:
> AddOutputFilterByType DEFLATE text/html
> BrowserMatch ^Mozilla/4\.0[678] no-gzip
> SetEnvIf response Content-Type text/html user-agent-vary=1
> Header append Vary User-Agent env=user-agent-vary
> With this patch, the correct vary headers are added in a reverse proxy situation.
> most of the code was adapted from mod_headers.
> Thoughts?

View raw message