• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 Wrong User's IP When Using Cloudflare

semprot

Active member
#1
Xenforo detects wrong user's IP address when the domain uses CloudFlare (cloudflare's IP becomes user's IP).
My server has installed mod_cloudflare.
I also have another website (a drupal) on the same server, and it detects user's IP perfectly.

Why it's only XF that detects wrong user's IP?
 

Liam W

Well-known member
#2
Cloudflare masks the IP using their own IP.

The only way to get around this is to add a snippet of code to the config.php file that sets the remote IP value to the value of the users IP provided in a header by cloudflare.

Or, remove cloudflare.
 

semprot

Active member
#3
Cloudflare masks the IP using their own IP.

The only way to get around this is to add a snippet of code to the config.php file that sets the remote IP value to the value of the users IP provided in a header by cloudflare.
Using mod_cloudflare on my server should resolve the problem automatically (according to cloudflare's documentation).
But XF is the only site on my server that doesn't detect IP correctly, my other website (but not xenforo site) on same server detects the IP correctly.

Update : strange mod_cloudflare doesn't fix automatically.
I have to do some file edits and it works :D
https://support.cloudflare.com/hc/e...o-I-restore-original-visitor-IP-with-XenForo-
 
Last edited: