WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. worldofjani.com
    Member
    Posted 8 months ago #

    Hello,

    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"..)

    Regards
    Jani
    http://blog.worldofjani.com

    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

    http://wordpress.org/plugins/visitor-maps/

Reply

You must log in to post.

About this Plugin

About this Topic

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