In times where Apache is sitting behind a reverse proxy (for example Squid), the cgi atmosphere variable REMOTE_ADDR will get the address from the proxy as opposed to the client.

However, the proxy sets a header known as X-Forwarded-For to retain the original Ip from the client to ensure that Apache can easily see it.

Now you ask ,, how can we get Apache to exchange REMOTE_ADDR using the value within the X-Forwarded-For header to ensure that all the web programs will transparently begin to see the correct address?

You should use mod_rpaf for your.

Keep in mind that this value could be spoofed. See for any real-existence example with Mix-site Scripting effects.