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

XF 1.1 Problems detecting the user IP (haproxy+nginx) [SOLVED]


I have problems with the IP assigned to each post user.

All time the IP assigned is the Haproxy IP, not the user IP.

I ran a phpinfo() and I get this:

_SERVER["REMOTE_ADDR"] XXX.46.142.66 (haproxy IP)

Then, I post something in the forum and click the "IP" button. I see the IP from REMOTE_ADDRR instead the HTTP_X_FORWARDER_FOR.

What do I do bad?

I'm using Xenforo 1.1.5


XenForo developer
Staff member
You can just set this in config.php:

Note that this will trigger an error if there's no X-Forwarded-For header. (And if you don't trust the X-Forwarded-For header, this can allow IP spoofing.)