CloudFlare: Users Suddenly Showing CF IPs Again

taylor_smith

Well-known member
Previously, adding this to config.php allowed XenForo to record user IPs, despite CloudFlare.

Code:
if (isset($_SERVER['HTTP_CF_CONNECTING_IP']))
{
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
As of today, I see lots of users all sharing CloudFlare IPs. Checked config.php and the above code is still there. Anyone else seeing the same? Have any possible solutions?
 
Visit admin.php?tools/phpinfo and make sure REMOTE_ADDR shows your correct IP. If it's not correct then you can contact your host or server person to fix this. Or look for a server variable that contains the correct IP and then add this code to your library/config.php file:

Rich (BB code):
// FIX IP ADDRESS FOR PROXY
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];

Replace the red part with the name of the server variable that contains the correct IP (from your phpinfo).
 
Well you were previously using HTTP_CF_CONNECTING_IP, so maybe that is incorrect in which case you need to revert to REMOTE_ADDR which is the default (remove your config.php code), or change your code to use whatever variable shows the correct IP.
 
What would the code be in that case? Initially, all users were sharing the CloudFlare IP. Wouldn't removing the code return us to this?

Sorry, I'm not very technical.
 
Unfortunately, when I removed it, my first post showed a CloudFlare IP.

Eh, maybe my host disabled something for a while, or maybe CloudFlare had some kind of update. I dunno.
 
Top Bottom