Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a web farm set up something like this:

          |-------------------> Apache1
 HAProxy -|
          |-------------------> Apache2

HAproxy has external IP x.x.x.x

Apache1 has 2 interfaces: internal y.y.y.y (for requests from HAProxy), and external IP z.z.z.z

Apache2 has 2 interfaces: internal yy.yy.yy.yy (for requests from HAProxy), and external IP zz.zz.zz.zz

Anytime I make requests outside the farm from one of the apache servers (such as a curl request in php to say,, the REMOTE_ADDR header is the external IP of the apache server making the call (yy.yy.yy.yy or zz.zz.zz.zz).

The problem is, some of the servers I make such requests to limit the IPs requests from. Ideally I'd like to provide them the IP of the HAProxy server (x.x.x.x), instead of having to give them the IPs of the 2 backend servers.

Is there any way to accomplish this in configuring either apache or haproxy?

share|improve this question
up vote 1 down vote accepted

You must configure apache to send request via a proxy server. The easiest setup is to install squid on the haproxy machine and implement transparent proxy at your router/firewall.

Assuming it's linux you can use this

If it's something else (cisco, checkpoint) they should all support similar setup.

If you don't have access to the firewall/router you can implement the transparent proxy on the actual apache machines.

share|improve this answer
just what I needed, thanks – DTest Aug 23 '11 at 17:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.