Bug 38096 - mod_proxy_balancer rewrites "Host:" HTTP headers
Summary: mod_proxy_balancer rewrites "Host:" HTTP headers
Status: RESOLVED INVALID
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
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-02 14:48 UTC by Guillaume Morin
Modified: 2006-01-04 03:01 UTC (History)
0 users



Attachments

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
Hello,

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>
        BalancerMember http://127.0.0.1:8080
    </Proxy>

</VirtualHost>

I run in a terminal "nc -l -p 8080" and then open with my browser the url
"http://testlb.spider.xxx".

That's what I got :

GET / HTTP/1.1
Host: 127.0.0.1:8080
User-Agent: ELinks/0.10.6-1-debian (textmode; Linux 2.6.11.11 i686; 80x35-2)
Accept: */*
Accept-Encoding: gzip
Accept-Language: fr
Max-Forwards: 10
X-Forwarded-For: 192.168.5.242
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