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

Cheers,
Francois Pesce
See also old discussion:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200409.mbox/[EMAIL PROTECTED]
http://mail-archives.apache.org/mod_mbox/httpd-dev/200409.mbox/[EMAIL PROTECTED]
http://mail-archives.apache.org/mod_mbox/httpd-dev/200409.mbox/[EMAIL PROTECTED]

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?

Attachment: mod_setenvif-2-0-x.patch
Description: Binary data

Attachment: mod_setenvif-2.2.x.patch
Description: Binary data

Reply via email to