Invalid CF-IPCountry header

Hi
Cloudflare provides invalid (XX) location in header CF-IPCountry. But the IP address is available in maxmind database.

E.g. x-forwared-for header in the requests contains ‘196.249.96.68,141.0.8.166, 162.158.163.70’
And if you paste this ip address at maxmindcom, you see the country code of the first IP - TZ.

Maybe there are some problems with the header format and CF expects only client-ip? Is it a way to configure this feature to trim proxy ips?
Thank you

Based on that information, it appears as if the request to Cloudflare did not come from 196.249.96.68 but rather 141.0.8.166.

That address appears to be a Singaporean Opera proxy and does not have a country assigned in MaxMind, which will be the reason why Cloudflare indicates an unknown country.

But why? According to
developer mozilla org
Syntax is
X-Forwarded-For: client, proxy1, proxy 2

So client IP should be 196.249.96.68

P.S (prev post deleted because the header example was parsed)

That is the syntax for that header, but that does not mean that Cloudflare will take a random header to determine the client address. That one is part of the IP packet, which is sent by the Opera proxies. Don’t route over that proxy and the correct address should show up.

Unfortunately i don’t control how the request is routed. But i want to know country code based on the header info. Is it configurable?

No, as long as the request goes via the proxy, the information for that address will be used. You could only block the Opera network altogether.

1 Like

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