Bug 38096 - mod_proxy_balancer rewrites "Host:" HTTP headers
Summary: mod_proxy_balancer rewrites "Host:" HTTP headers
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_balancer (show other bugs)
Version: 2.2.0
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2006-01-02 14:48 UTC by Guillaume Morin
Modified: 2006-01-04 03:01 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Morin 2006-01-02 14:48:16 UTC

I tried the new module mod_proxy_balancer from apache 2.2. last week and I
get a strange behaviour with it. It doesn't conserv the "Host:" header of the
HTTP request when forwarding to the backend servers. Let me illustrate it :

Here is the virtual host configuration of my test :

<VirtualHost *>
    ServerName testlb.spider.xxx
    ErrorLog /var/www2/logs/testlb/error_log
    CustomLog /var/www2/logs/testlb/access_log combined

    ProxyPass / balancer://cluster stickysession=mysessionid nofailover=On
    <Proxy balancer://cluster>


I run in a terminal "nc -l -p 8080" and then open with my browser the url

That's what I got :

GET / HTTP/1.1
User-Agent: ELinks/0.10.6-1-debian (textmode; Linux i686; 80x35-2)
Accept: */*
Accept-Encoding: gzip
Accept-Language: fr
Max-Forwards: 10
X-Forwarded-Host: testlb.spider.xxx:80
X-Forwarded-Server: testlb.spider.xxx

That's not what I expected. Most of the load balancer (like pound or haproxy for
example) would send something like :

GET / HTTP/1.1
Host: testlb.spider.xxx

This make possible the use of virtualhosting behind the load balancer.

I know it is not really a 'bug', but it makes this module useless in my
situation, and I think many users will have the same problem.

Perhaps am I wrong ?
Is there something I miss ?

Thank you for your work,

Guillaume Morin
Comment 1 Joshua Slive 2006-01-04 03:50:55 UTC
Have you tried the ProxyPreserveHost directive?
Comment 2 Guillaume Morin 2006-01-04 12:01:54 UTC
No, I didn't try, was just looking to the mod_proxy_balancer documentation. 

It works fine, I'm really sorry for the bother.

Perhaps ProxyPreserveHost could be enabled by default when using
mod_proxy_balancer ?

Guillaume Morin