Maxmind Geo IP always returning “IL”, “CA” or “US” – how can i debug?
-
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!
- The topic ‘Maxmind Geo IP always returning “IL”, “CA” or “US” – how can i debug?’ is closed to new replies.