This may be a tricky one.
Is it possible (via an app or worker) to dynamically inject GeoIP info (maybe add a cookie header?) to a cached page?
I have a site with html pages that I want to be cached by CloudFlare. But now with GDPR I want to dynamically determine if I need to show the cookie compliance banner. Of course, I could always make another XHR to the server and determine the country from the HTTP_CF_IPCOUNTRY header, but I’d avoid an extra call if possible (I want to keep it as fast as possible).
I’m not to CF and I don’t know what the Apps and Workers are capable of, so can either of them do the following:
- read the HTTP_CF_IPCOUNTRY from the request
- get the cached html and either
a. add a cookie header in the response or
b. add some js code in the page itself, e.g.