Support » Plugin: Contact Form DB » IP is fetched from CDN

  • Rihards

    (@hellomynameisrihards)


    Hi,
    Do you know how to get the users IP correctly in DB? We get the CDN IP for all the signups.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    This is how I get it in PHP:
    $ip = (isset($_SERVER['X_FORWARDED_FOR'])) ? $_SERVER['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];

    After doing a quick web search, I see that there are other headers that I could check but it doesn’t seem to be a convention on what is correct. For example:
    X-Real-IP
    HTTP_TRUE_CLIENT_IP
    HTTP_CLIENT_IP
    CLIENT-IP

    So I’m a bit lost.

    It would be interesting to see what headers are coming thru your system. Please post.

    Thread Starter Rihards

    (@hellomynameisrihards)

    Alright, will check it out, and let you know the progress.

    Plugin Author Michael Simpson

    (@msimpson)

    I put in some code in update 2.10.23 (available shortly) to try to be a bit more sophisticated in determining the client IP. Give it a try.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘IP is fetched from CDN’ is closed to new replies.