X-Forwarded-For (reverse proxy) solution suggestion
-
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
https://blog.worldofjani.comfunction 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
- The topic ‘X-Forwarded-For (reverse proxy) solution suggestion’ is closed to new replies.