Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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, google.com), 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

1 Answer 1

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

http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html

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

 
discard

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.