• Resolved kopfnick

    (@kopfnick)


    I am trying to debug this for two days now (on and off ;)), but cannot get any further than this:

    We have Sucuri WAF running with its CDN. This messes with IPs, but I set this in “the right way” (via the Sucuri Plugin acording to docs) so that $_SERVER[“REMOTE_ADDR”] reports the correct IP (i echoed it, it is ok).

    I then put this in functions.php so that i see what Woocommerce/Maxmind thinks:
    $location = WC_Geolocation::geolocate_ip();
    $country = $location[‘country’];
    echo $country;

    With this, i always get IL (sometimes yesterday i saw US or CA). I am thinking it could be the firewall (always these three locations), but as i said, the REMOTE_ADDR returns the right IP since i set up Sucuri “right”.

    Another thing i tried is installing the plugin “Geolocation IP Detection”. I activated Maxmind in the options there, too and set the same database file as Woocommerce. THERE i see the right countries reported (tried DE and AT, works beautifully).

    Even on the same page, one says DE, the other IL ??

    So, isn’t WC also using REMOTE_ADDR? Maybe sucuri corrects the IP “too late” for Woocommerce and the IP detection happens earlier? What else can i do to debug?

    Any help would be appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Niall a11n

    (@wpniall)

    Hi @kopfnick!

    REMOTE_ADDR detects the nearest requesting IP and not any other. If there are other further IPs, such as a proxy or firewall, then the requesting IP might be different. You may be seeing Sucuri’s addresses rather than the IP address you’re expecting.

    Have you tried checking the location with the Sucuri firewall disabled first, then the Sucuri plugin disabled entirely? That should let you rule out Sucuri as affecting the IP address.

    Plugin Support Niall a11n

    (@wpniall)

    Hi again,

    We haven’t heard back from you for a while, so I’m going to mark this as resolved – if you have any further questions or need further help, please start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Maxmind Geo IP always returning “IL”, “CA” or “US” – how can i debug?’ is closed to new replies.