Join the Webstudio community

Updated 2 months ago

CF-IPCountry header information?

At a glance

The community member is interested in serving geo-targeted content to their visitors and is aware that Cloudflare's CF-IPCountry header contains the necessary country location information. The comments suggest that this information could be easily added to the request headers, allowing the API to use it to serve adapted content. Some community members mention adding the information to a system variable, using third-party IP to country data services, and creating an issue to follow up on this request. However, there is no explicitly marked answer in the comments.

Useful resources
I'd like to be able to either serve geo-targeted content to my visitors. Cloudflare has the CF-IPCountry header that contains the necessary country location information I need. Any thoughts on how I can see this header data so that I can make use of it?
1
O
I
A
6 comments
Just checked with the team. Indeed that info could be easily added to request headers we are creating for the API calls, so on the API side one could use that info to serve any adapted content. Sounds like a low hanging fruit, you are the first one to ask for it!
We can add that info into system variable
(Some fake data at the builder, but real at the published site)
Attachment
image.png
There are many third party API services that provide IP to country data. I just liked the idea of keeping as much as I can within the CF ecosystem.
This will invalidate all cdn caches
Yeah, endpoint should be fast if someone is using this
Add a reply
Sign up and join the conversation on Discord