In addition to REMOTE_ADDR and HTTP_X_FORWARDED_FOR there are some other headers that can be set such as:
HTTP_CLIENT_IPHTTP_X_FORWARDED_FORcan be comma delimited list of IPsHTTP_X_FORWARDEDHTTP_X_CLUSTER_CLIENT_IPHTTP_FORWARDED_FORHTTP_FORWARDED
I found the code on the following site useful:
http://www.grantburton.com/?p=97