• Resolved Joshua David Nelson

    (@joshuadnelson)


    Hello,

    I’m using this plugin with the free database. The server is in San Jose, and regardless of the settings to this plugin it’s always delivering the San Jose result (even though I’m in Washington), instead of the user IP.

    I noticed that under the proxy option it is showing two IP addresses in the “with proxy” part under the “The server is behind a reverse proxy” option: the first is the correct user IP address, the second is the server. Regardless of if that box is checked, both the with and without proxy results are some variation of the server IP address(es).

    It looks something like this: (With Proxy: yyy.yyy.yyy.yy, xx.xx.xx – Without Proxy: xx.x.xx.xxx – Client IP with current configuration: xx.xxx.xx.xx)

    How do I get the correct results on the front end (the first IP address in the “with proxy” part, noted above as yyy.yyy.yyy.yy, not the second one which is the returned value currently)? Does the plugin need to parse the IP addresses differently?

    Thanks,
    Joshua

    https://wordpress.org/plugins/geoip-detect/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Benjamin Pick

    (@benjaminpick)

    Actually you have multiple reverse proxies (that’s why there is a , in the “With Proxy”-Part). This is not supported by the UI yet, but the backend is ready. You need to white-list all known server ips:

    In your functions.php, write:

    if (is_admin()) {
      update_option('geoip-detect-trusted_proxy_ips', 'xx.xx.xx, xx.xx.xx, xx.xx.xx');
    }
    

    This only has to be executed once, afterwards you can remove the code lines and if you need to change it again, use yoursite.com/wp-admin/options.php (or use these code lines again).

    Thread Starter Joshua David Nelson

    (@joshuadnelson)

    Benjamin,

    It would be great if I could filter the IP address from this array. For instance, with multiple proxies that change, it looks like I always need the first one on this outputted list. Is that possible? If not, could you point me to where in the code this option is checked and I could add a filter?

    Thanks,
    Joshua

    Thread Starter Joshua David Nelson

    (@joshuadnelson)

    It looks like I can filter the final IP address via geoip2_detect2_client_ip, but it would be great if if the $ip_list variable was included in the filter. I’ve made a pull request on the github proposing this change, let me know your thoughts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Mulitple IP Addresses/Proxy Issue’ is closed to new replies.