Gmane
From: Tom Evans <tevans.uk <at> googlemail.com>
Subject: Re: Is this possible with Apache
Newsgroups: gmane.comp.apache.user
Date: 2008-10-10 15:53:01 GMT (12 weeks, 4 days, 11 hours and 52 minutes ago)
On Fri, 2008-10-10 at 11:52 +0200, export <at> hope.cz wrote:
> This problem:
> 
> Client with IPaddress 1	 opens a webpage( starts CGI script
> on Apache1.)
> (Here on Apache1 is running an application/CGI script)
> That script will fetch a page from  	Apache2.
> 
> So far so easy but I need the  Client's  IPaddress 1 to be recorded  in log of  Apache 2 NOT 
> Apache1's address.
> 
> Something like this
> 
> 
> Client's  IPaddress 1 				Client's  IPaddress 1
> 
> Client ------------------>Apache1  ------------>Apache2
> 
> 			Apache1's addreess
> 
> 
> Is this possible? Or must I use another proxy?
> 
> Thank you for  your reply.
> Lad.

Add an appropriate 'X-Forwarded-For'[1] header with the client's IP
address to the request headers when the CGI script requests the resource
from apache2, and then use mod_rpaf[2] to fixup the request inside
apache2, so that it appears to come from the client, and is logged as
such.

If you are already behind a reverse proxy, you should append to the XFF
header in the request headers from apache1. If you are not, you should
construct a new one (do not trust XFF headers received from clients).

[1] http://en.wikipedia.org/wiki/X-Forwarded-For
[2] http://stderr.net/apache/rpaf/

Cheers

Tom