Why Does Every Visitor To My Cloud Sites Website Have The Same IP Address?


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

//

PHP

If your website technology is PHP, the following apply.

Without SSL

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']

With SSL

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']

ASP

If your website technology is ASP or ASP.NET, the following apply.

Without SSL

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")

With SSL

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")

 



Was this content helpful?




© 2014 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER