Apache reverse proxy, redirect requests based on IP addresses

Posted by Mr Aleph on Server Fault See other posts from Server Fault or by Mr Aleph
Published on 2011-11-29T15:32:58Z Indexed on 2011/11/29 17:53 UTC
Read the original article Hit count: 300

Filed under:
|

I have a Linux box with 2 NICs. I installed and configured Apache 2 for reverse proxy.

Each NIC has its own IP address and I was wondering if there is any way to redirect the requests via Apache based on the IP address that was used to get to the box.

For example: eth0 has IP 100.100.100.100, eth1 has 200.200.200.200

If I browse to http://100.100.100.100/AppName/App I want it to redirect to 1.1.1.1 and if I browse to http://200.200.200.200/AppName/App I want it to go to 2.2.2.2

Right now the configuration for Apache is set as follow

ProxyPass /AppName/App http://1.1.1.1/AppName/App
ProxyPassReverse /AppName/App http://1.1.1.1/AppName/App

So anything going to /AppName/App will be redirected to 1.1.1.1

I was reading something about ProxyHTMLURLMap but I don't know whether this is something that might help.

Any idea how to do this? Thanks!

© Server Fault or respective owner

Related posts about apache2

Related posts about reverse-proxy