Using CloudFlare with XF2 and IP address


Well-known member

on XF1 when I add this if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; } to config.php it shows my real IP address, but in XF2 it shows CloudFlare's.

How can I show my real IP with CloudFlare on XF2?

Thanky you.


Wildcat Media

Well-known member
Did XF 2.2 change this? I've noticed that despite using Cloudflare, my IP addresses were still correct, and I haven't yet added mod_remoteip to Apache in order to do this. I added it to config.php just now, for good measure, but I wondered if maybe it was coded in to XF somewhere else that I'm missing.

Chris D

XenForo developer
Staff member
Yes. We detect and resolve common proxy IP addresses to the original IP address of the user. Usually without any action required on your part.

Although we only update this each time we release a new version so it’s another good reason to keep XF as up to date as possible.