I am using DEFLATE to dynamically compress xml files using apache 2.0.52 and noticed that etag remains the same whether or not the resources are send with Content-Encoding:gzip or unencoded.
Issue https://issues.apache.org/bugzilla/show_bug.cgi?id=39727 describes this issue. I am trying to find a work around by adding some configuration magic. I attempted to do this as follows (in .htaccess): # Set variable UNQUOTED_ETAG to the unquoted etag value if # this is a resource that will be gzip encoded. RewriteEngine on RewriteCond %{HTTP:Accept-Encoding} gzip RewriteCond %{HTTP:ETag} ^"([^"]*)"$ RewriteRule .*\.(xml)$ - [env=UNQUOTED_ETAG:{%1}] # If UNQUOTED_ETAG is set modify header to include gzip Header set ETag "%{UNQUOTED_ETAG}e-gzip" env=UNQUOTED_ETAG However this is not working. I can observe in the rewrite log: 127.0.0.1 - - [15/Sep/2009:09:35:06 --0700] [localhost/sid#e35148][rid#1f9e0c8/initial] (4) [perdir C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/Gzip/] RewriteCond: input='' pattern='^"([^"]*)".*$' => not-matched that the input is empty, probably because the ETag is a response header and not available to the RewriteCond yet. Is there a way to reference response headers in the rewrite rules/conditions? Is there another way to accomplish working around issue 39727? Thanks, Henrich PS: A later apache version has the Etag header value changed by appending -gzip. However the quoting wasn't done correctly so that the header in that version is: Etag: "44d0ac3fd1f00"-gzip While the specs require the entire value be in quotes such as in Etag: "44d0ac3fd1f00-gzip" Comment 5 of the related issue (https://issues.apache.org/bugzilla/show_bug.cgi?id=45023#c5) corrects this: <Location /js> RequestHeader edit "If-None-Match" "^(.*)-gzip$" "$1" Header edit "ETag" "^(.*[^g][^z][^i][^p])$" "$1-gzip" </Location> However this depends on the edit feature which is not yet available in httpd version 2.0.52.