By default some scripts will attempt to retrieve the IP address of a visitor using the REMOTE_ADDR HTTP header. Due to the nature of our environment your script may receive the IP of one of our load balancers, rather than the IP address of the visitor viewing your site in his or her browser. In order to retrieve the correct IP address of the visitor, your script may need to be updated according to the instructions below.
Contents |
//
If your website technology is PHP, the following apply.
If your site does not have SSL installed in your Rackspace Cloud control panel, the visitor's IP address will be available via HTTP_X_CLUSTER_CLIENT_IP or REMOTE_ADDR. These are contained in the $_SERVER global variable, accessible from code as follows:
$_SERVER['HTTP_X_CLUSTER_CLIENT_IP']
or...
$_SERVER['REMOTE_ADDR']
If your site has SSL installed in your Rackspace Cloud control panel, the visitor's IP address will be available via HTTP_X_FORWARDED_FOR. This is contained in the $_SERVER global variable, accessible as follows:
$_SERVER['HTTP_X_FORWARDED_FOR']
If your website technology is ASP or ASP.NET, the following apply.
If your site does not have SSL installed in your Rackspace Cloud control panel, the visitor's IP address will be available via HTTP_X_CLUSTER_CLIENT_IP. This is contained in the Request.ServerVariables global variable, accessible as follows:
Request.ServerVariables("HTTP_X_CLUSTER_CLIENT_IP")
If your site has SSL installed in your Rackspace Cloud control panel, the visitor's IP address will be available via HTTP_X_FORWARDED_FOR. This is contained in the Request.ServerVariables global variable, accessible as follows:
Request.ServerVariables("HTTP_X_FORWARDED_FOR")
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

6 Comments
apply HTTP_X_CLUSTER_CLIENT_IP to REMOTE_ADDR on Nginx server
so if my live site has ssl
Use Conditionals
just have the key from a config file
$WHOIS_IP = $_SERVER[$cfg->whois_associativekey];
For your SSL site on Rackspace it is now an easy config file setting and your application script never changes. $cfg->whois_associativekey = 'HTTP_X_FORWARDED_FOR';
List Of IPs
A list of IP addresses in
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers
Add new comment