Visitor IP Address and HT Access

we use cloudflare for some of our WP sites and on one of them that we use IP access restrictions via a plugin is not working. - after investigation the reason it is not working is that it is seeing an entirely different ip address than what is the visitors real ip.

I assume this is a cloudflare thing - because we dropped a short code on another site that is not using clouflare and we see the proper ip address.

is there a setting we can switch or something we can put in htaccess to pass the visitors real ip address.

The web server needs to be configured for Cloudflare. Or custom code in your site software.

THX, - I cut a ticket with CloudWays as well and the solution was…

set WAF to CloudWays in the Server “Settings & Packages”
then add this code to the wp-config file

xffaddrs = explode(',',_SERVER[‘HTTP_X_FORWARDED_FOR’]);
$_SERVER[‘REMOTE_ADDR’] = $xffaddrs[0];

and Finally, restart Apache in the server “Manage Services”

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.