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

Discussion in 'Troubleshooting and Problems' started by toni.marmol, Jul 31, 2013.

  1. toni.marmol

    toni.marmol Member


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

    Mike 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.)
    toni.marmol likes this.
  3. toni.marmol

    toni.marmol Member

    Thanks, Mike.

Share This Page