Thanks for the excellent question.Yea, I've seen this issue myself in the past. Most apps like s2Member
( in my opinion ), should just use
$_SERVER["REMOTE_ADDR"], so that you don't have several plugins, all using a different set of techniques. In other words, ideally, you want your server to report this information inside
$_SERVER["REMOTE_ADDR"], and ideally, every application you have running would use that standardized Super Global. This way all software that collects IP addresses, will use the same source
( i.e. whatever value your server places into $_SERVER["REMOTE_ADDR"] ).
Now, I'm aware that some Cloud Computing models do NOT fill this field correctly, but
( in my opinion ), the solution is not to change each individual piece of software, but rather, to implement something on your own to normalize the existing Super Global
$_SERVER["REMOTE_ADDR"].
Here's how it's done on Rackspace Cloud Computing models.1. Open your php.ini file ( or it can also be done via .htaccess ).
Using PHP.ini do this:
auto_prepend_file = /path/to/remote-addr.phpOr, using .htaccess, do this:
php_value auto_prepend_file /path/to/remote-addr.php2. Create the /remote-addr.php file with this PHP code snippet.
For Rackspace, you would use something like this:
- Code: Select all
<?php
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_X_CLUSTER_CLIENT_IP"];
?>
* No spaces or extra lines before or after <?php ?>
Or, if your Rackspace account has SSL enabled ( i.e. you have an SSL-enabled IP, use this )
- Code: Select all
<?php
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_X_FORWARDED_FOR"];
?>
Reference articles:http://cloudsites.rackspacecloud.com/in ... address%3Fhttp://stackoverflow.com/questions/3841 ... php-scripthttp://www.php.net/manual/en/ini.core.p ... epend-file