How to configure Apache web server to redirect the requests it receives without modifying the source IP

apache-2.2apache-2.4ipPROXY

Unfortunately I don't know about web servers but I'm trying to help a colleague. We have an Apache web server setup and we need it to redirect resend the requests it gets to an application server while keeping the source ip the same it was when apache received it.

Whats happening is:

  1. A client (IP: 1.1.1.1) sends a request to Apache web server
  2. Apache web server (IP: 2.2.2.2) redirects its requests to an application server
  3. The application server sees the source IP as (2.2.2.2) which is Apache's !

How can I configure Apache to let it redirect the requests to the Application server without changing the source IP, so in the mentioned example, the application server would receive 1.1.1.1 as the source IP address.

Sadly, using headers is our last option because it will force us to do a wide scale change in our applications.

Best Answer

If you want to retain the IP address so you don't have to do the wide scale application change you mentioned, you can enable IP forwarding and then do forwarding of the traffic at the IP level rather than via proxying (see http://www.debuntu.org/how-to-redirecting-network-traffic-to-a-new-ip-using-iptables/ for an example).

If using Windows, check out netsh interface portproxy add v4tov4 (see https://technet.microsoft.com/en-us/library/cc731068(v=ws.10).aspx#BKMK_1).

Related Topic