How to see visitor’s real IP with Cloudways and Cloudflare

If you’re using Cloudflare in front of your Cloudways site, you’ll notice that all the visitors come through with the IP address of It’s easy enough to fix this. Cloudways posted a useful article about it, but it misses one critical thing – the WordPress configuration!

First, head to your server configuration on Cloudways, and choose Settings & Packages > Advanced:

Scroll down until you fine the WAF Module setting, and change that to Cloudflare:

You’ll also need to restart your Apache service.

Then, for each of your WordPress sites, you’ll need to add this code to your wp-config.php :

Once you’ve done that, look in the logs, or post yourself a test comment to verify that the IP address is coming through correctly. Should be all good!

Leave a Reply

Your email address will not be published. Required fields are marked *