The following returns the current country code:
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const country = request.headers.get('CF-IPCountry')
return new Response(`Hello world ${country}`)
}
It works on on a live site.
It works on the Workers Playground online app.
It doesn’t work in the Cloudflare Online editor. It returns null
.
So my question:
Is it possible to enable country detection (the CF-IPCountry header) in the online Workers editor?
Thanks