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

Hello,

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)
_SERVER["HTTP_X_FORWARDED_FOR"] XXX.43.201.67 (user 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
 
You can just set this in config.php:

Code:
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_X_FORWARDED_FOR"];
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.)
 
Top Bottom