Problem: host header keeps the IP of the HAProxy server

From: Ran S <ran#sheinberg.net>
Date: Wed, 10 Aug 2011 17:00:19 +0300


Hello all,

I am trying to use HAProxy for the following configuration: Two Linux servers (node1, node2) running apache (on port 85) and squid and acting as Proxy servers to the Internet
I installed HAProxy on node1, and configured it to listen to port 80, and have the backends in their respective apache port 85.

While node1 is the only active server in the backend servers list, I can make a request to node1:80 and it will be successfully redirected to the apache port and returned to me.

However while node2 is the only active backend server, this flow will fail and I will simply get a blank page with HTTP 200. I think I know why that is. when sniffing on node1, I can see the following request flow:

  1. My browser making web the request to node1:80
  2. Node1 making the request to node2. But, this is where the problem comes in. The source IP is node1 The Destination IP is node2 However the Host in this request is the node1 IP address

So, since node2 backend server is actually a proxy server, it will take the IP address from the Host header it received and make a request to node1 (since it has it in the request's Host header) and the failure will come in.

So I guess what I'm asking is what would be the correct option to use in HAproxy in order to have this set up the right way.

I copied the configuration file from one of the examples and trimmed it down to the very basic so I can eliminate anything that's causing the problems, so here it is:

Many thanks in advance for any help! please let me know if you need any more information.

Thanks,
Ran Received on 2011/08/10 16:00

This archive was generated by hypermail 2.2.0 : 2011/08/10 16:15 CEST