Cf-ipcountry is doesn't return the correct location

What is the name of the domain?

https://gringo.co.il

What is the issue you’re encountering

The value returns from the cf-ipcountry is not correct

What steps have you taken to resolve the issue?

I have this code that used to work, but now it doesn’t because it returns Colombia and Santa Marta as the city which is false.
countryCode = context.Request.Headers[“cf-ipcountry”];
city = context.Request.Headers[“cf-ipcity”];

Is this a known issue? It used to work fine until now.

Cloudflare gets its IP location information from Maxmind. Check here and if it is wrong you can submit a correction to them…
https://www.maxmind.com/en/geoip-web-services-demo

I already checked it and I get the correct address, but I think somewhere between maxmind to Cloudflare something went wrong. Is it possible for someone to check if he gets using Cloudflare the correct address?

In my website I write to the console the location of the user, you can see the problem in production.

This page here will show you the location headers Cloudflare passes…

They should match the data from Maxmind. If they don’t it may be they have been updated recently.

So instead of
countryCode = context.Request.Headers[“cf-ipcountry”];
it should be
countryCode = context.Request.Headers[“country”];
?

cf-ipcountry is the correct header.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.