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.
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.