Can I get the CF-IPCountry header as a cookie?

I’m building a cookie consent page, and I would like to be able to receive the user’s country as a cookie so I can detect in page JavaScript whether they are in the EEA and so need a cookie popup. I don’t want to do this on my server as that would require completely disabling caching for all new users on all pages, which is completely unfeasible. Is there some standard Cloudflare solution to cookie consent that allows me to target only EEA+UK/Switzerland users with a cookie consent form?

I think you are not trying to cache HTML pages right? I guess you can insert the cookie for application/html and text/html content type. This will prevent all other resources (images, CSS, javascript) from being uncached.

I don’t think so if I can recall.

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