A question arose with a client site in which they wanted to know how
they could extract and log the client ip when the request forwards
through a reverse proxy.
The situation looked liked this:
Client ------------> Reverse Proxy ------------> Web Server
Client <------------ Reverse Proxy <----------- Web Server
In order to find the IP address of the original client, they wanted to capture the
"X-Forwarded-For" header in web server access log and error log.
The way to do this is by using the custom log format available on the Sun WebServer.
If the reverse proxy is adding:
X-Forwarded-For: header to the request, the Web Server can be configured
to log that header field by adding %Req->headers.x-forwarded-for% to the access log format.
(Note that the Web Server doesn't add an X-Forwarded-For: header when it reverse proxies requests.
It does, however, add a Proxy-ip: header).