All web traffic as Cloudflare IP addresses?

Hello. I’m almost positive there is a simple solution for this, but since moving my domain/websites to Cloudflare my traffic logs show only Cloudflare IP addresses for visitors. Is there a way to get back my original traffic tracking with actual visitor IP addresses? On a shared Apache server (godaddy). I would love to know what others are doing to circumvent this or if it is even possible. Thanks!

1 Like

Greetings,

Thank you for asking.

Kindly, see below article for instructions on how to configure your web server to log original visitor IPs based on your web server type when using Cloudflare for your domain:

Thanks for this, but as I mentioned I’m on a shared server and don’t have access to mod installs and system restarts. I can however use .htaccess files if that is possible?

Sorry, but that has to be handled at the server config level.

With all the people on GD, I’m surprised I haven’t heard more of this. Have you asked godaddy support?

1 Like

Got it working based on the link that was provided by @fritex. Thanks @fritex. For anyone else, you need to paste this code before the close of the tag: <?php if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];?>

That seemed to work now correctly recording the original visitor IP addresses.

Thanks @sdayman. Found the answer at the link given above.

And that fixes your Apache logs?

2 Likes

I did not have a problem with the Apache logs. I had a problem seeing realtime IP addresses in an Analytics backend called Matomo. I would instead show the 172.xxx.xxx.xx the is the Cloudflare fingerprint. Now, I’m back seeing the original visitor IP addresses. Hope that make sense.

May I suggest below then below article from Matomo FAQ:

; Uncomment line below if you use CloudFlare
;proxy_client_headers[] = HTTP_CF_CONNECTING_IP

Another useful article to check:

Yep, but I am a bit afraid as you might end-up having some other issues (maybe) in future if not implemented correctly and permanently at the origin host/server (despite shared hosting).

1 Like

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