You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Paul Fee <pa...@operamail.com> on 2006/11/06 18:58:03 UTC

Header compression (or lack of) in mod_proxy

Hello all,

I'm using Apache as a HTTP proxy.  Regarding the request and 
response headers, I've done some tests and noticed different 
behaviour in the request and response direction.

The request headers are compressed (i.e. headers with same name are 
merged into one header and comma separated). e.g.

hdr: value1
hdr: value2

becomes,
hdr: value1, value2

This due to ap_get_mime_headers_core() calling 
apr_table_compress().  It occurs in protocol.c before Apache even 
detects that the incoming request is a proxy request.

The response headers on the other hand are read by mod_proxy in 
ap_proxy_read_headers() which calls apr_table_add() but not 
apr_table_compress().

RFC 2616 states that header compression MUST be allowed.

However if a proxy is between a non-compliant client and/or server 
then it would be best to leave the headers in their original form.  
If a direct connection works and a proxied connection fails then 
the proxy will be perceived as the problem.

Could someone point out a reason for the different behaviour in the 
request and response path?

How about making the behaviour configurable so that it's consistent 
in both directions and if necessary the headers can be left in 
their original uncompressed form?

By the way, my tests were on httpd 2.0.59, however reading the 
source for 2.2.3 suggests the same behaviour.

Thanks for your time,
Paul


-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com

Powered by Outblaze

Re: Header compression (or lack of) in mod_proxy

Posted by Graham Leggett <mi...@sharp.fm>.
Paul Fee wrote:

> Could someone point out a reason for the different behaviour in the 
> request and response path?

Cookies.

Cookie headers cannot be compressed as the RFC says they should be, so 
proxy works around this by not compressing headers.

> How about making the behaviour configurable so that it's consistent 
> in both directions and if necessary the headers can be left in 
> their original uncompressed form?

In theory, the idea that it be consistent in both directions is not 
unreasonable - it follows the principle of "be lenient in what we accept".

Regards,
Graham
--