Bug 37559 - mod_deflate + mod_proxy overwrite the Vary: header
Summary: mod_deflate + mod_proxy overwrite the Vary: header
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: All (show other bugs)
Version: 2.0.55
Hardware: All All
: P2 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-18 17:58 UTC by Marc Guardiola
Modified: 2005-11-21 12:24 UTC (History)
0 users



Attachments
Patch against 2.0.x (merge Vary instead of setting it) (658 bytes, patch)
2005-11-19 00:37 UTC, Ruediger Pluem
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Guardiola 2005-11-18 17:58:24 UTC
Hi, 

mod_deflate seems to overwrite Vary headers set by applications (or 
mod_headers) when serving proxied content. 

Below my virtualhost configuration and the test data. 

_____________
# cat /usr/local/apache/conf/deflate.conf
<Virtualhost *>
  ServerName            direct.test.nl
  DocumentRoot          /var/www/html
  AddOutputFilterByType DEFLATE text/html text/plain text/css
</VirtualHost>

<Virtualhost *>
  ServerName            proxy.test.nl
  ProxyPass             /       http://backend.test.nl/
  ProxyPassReverse      /       http://backend.test.nl/
  AddOutputFilterByType DEFLATE text/html text/plain text/css
</VirtualHost>

<Virtualhost *>
  ServerName            backend.test.nl
  DocumentRoot          /var/www/html
</VirtualHost>
_________________

# cat test.cgi
#!/bin/sh

echo "Content-type: text/html"
echo "Vary: Accept"
echo ""
echo ""

echo    "
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<title>Test</title>
</head>
</body>
</html>
        "
______________

# wget --header="Accept-Encoding: compress, gzip" -SO backendhtml 
backend.test.nl/cgi-bin/test.cgi 2>&1 | grep Vary
 4 Vary: Accept

# wget --header="Accept-Encoding: compress, gzip" -SO directhtml  
direct.test.nl/cgi-bin/test.cgi 2>&1 | grep Vary
 4 Vary: Accept,Accept-Encoding

# wget --header="Accept-Encoding: compress, gzip" -SO proxyhtml   
proxy.test.nl/cgi-bin/test.cgi 2>&1 | grep Vary
 4 Vary: Accept-Encoding

______________
The last request should generate the same Vary header as the second one..


Kind regards, 

Marc Guardiola
Comment 1 Marc Guardiola 2005-11-18 18:15:28 UTC
Forgot to mention that mod_proxy is not the cause, without mod_deflate it works 
fine (The Vary header is not deleted by mod_proxy):

# cat /usr/local/apache/conf/deflate.conf
<Virtualhost *>
  ServerName            backend.test.nl
  DocumentRoot          /var/www/html
</VirtualHost>

<Virtualhost *>
  ServerName            proxynodeflate.test.nl
  ProxyPass             /       http://backend.test.nl/
  ProxyPassReverse      /       http://backend.test.nl/
</VirtualHost>

__________________

# wget --header="Accept-Encoding: compress, gzip" -SO proxynodeflate      
proxynodeflate.test.nl/cgi-bin/test.cgi 2>&1 | grep Vary
 4 Vary: Accept

Regards, 

Marc
Comment 2 Ruediger Pluem 2005-11-19 00:37:14 UTC
Created attachment 16995 [details]
Patch against 2.0.x (merge Vary instead of setting it)

I think you hit the problem that has been fixed on the trunk in r161691
(http://svn.apache.org/viewcvs.cgi?rev=161691&view=rev). Please try if the
attached patch fixes your problem.
Comment 3 Marc Guardiola 2005-11-21 12:00:18 UTC
It works! Vary headers set by applications and/or by mod_headers are merged now.

Thanks!

Marc
Comment 4 Ruediger Pluem 2005-11-21 21:24:12 UTC
Proposed for backport to 2.0.x:
(http://svn.apache.org/viewcvs.cgi?rev=347969&view=rev)