Visitor Maps and Who's Online
X-Forwarded-For (reverse proxy) solution suggestion (1 post)

  1. worldofjani.com
    Posted 1 year ago #


    I have my wordpress behind a reverse proxy due to technical limitations with IP-adresses. With the current Visitor Maps, it will get the IP-adress of the proxy as the visitor. I.e. every visitor is identified as my proxy-internal-lan IP.

    I did some testing and posting a possible solution below, havent tested throughoutly but seems to work in my setup. It requires that your reverse proxy sends the original ip in the X_FORWARDED_FOR.

    Perhaps you could have an option in the settings, a checkbox for "Use HTTP_X_FORWARDED_FOR instead of REMOTE_ADDR" or so..

    (Depending on your network setup, you might want better filtering, or a exclusion list to use on originating IP.. "IF NOT INTERNAL LAN ADRESS, USE HTTP_X_FORWARDED_FOR"..)


    function get_ip_address() {
       // determine the visitors ip address
       if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
       } else {
            $ip = 'unknown';
       return $ip;
    } // end function get_ip_address


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Visitor Maps and Who's Online
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by worldofjani.com
  • This topic is not resolved
  • WordPress version: 3.7.1