httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Fritsch" ...@sfritsch.de>
Subject mod_filter and adding to the Vary header in 2.2.x
Date Tue, 31 May 2011 12:19:06 GMT
Hi,

if I use mod_filter to configure mod_deflate like this:

BrowserMatch ^Mozilla/4 no-gzip
BrowserMatch "\bMSIE [7-9]" !no-gzip
Header append Vary User-Agent env=!dont-vary
FilterDeclare compress-response
FilterProvider compress-response DEFLATE Content-Type $text/
FilterProvider compress-response DEFLATE Content-Type
$application/x-javascript
FilterProtocol compress-response change=yes;byteranges=no

How can I make sure in 2.2.x that the vary header is only added if the
DEFLATE filter is actually inserted into the filter chain?

Without mod_filter, I used something like

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|zip|pdf|png)$ no-gzip dont-vary

But SetEnvIf does not work on the Content-Type.

I think in 2.3.x, this can be taken care of by using an appropriately
complicated expression, like

FilterProvider compress-response DEFLATE \
 "%{CONTENT_TYPE} =~ m,^(?:text/|application/x-javascript), && (
http('User-Agent') !~ m,^Mozilla/4, || http('User-Agent') =~ /MSIE [7-9]/
)"

I haven't tried it, but because of the short-circuit behaviour of "&&",
ap_expr should only add "Vary: User-Agent" if the match on the
content-type succeeds.

But is there a way to do this in 2.2.x, too?

Cheers,
Stefan


Mime
View raw message