Cache bucket per each country


As I was having a caching issue with my site, I have just requested my webhosting company to setup a different cache bucket per each country. I was wondering, how does the cache works in Cloudflare when the site requires specific rules based on the geolocation? Let’s say that a page hasn’t been cached at all and a visitor from Italy will visit it and generate the cache. Will this cached page be available only for visitors from Italy or will this cache be provided to other country as well? I need to be sure that the cache provided isn’t shared between countries

Thanks for the help

Every data center edge node has its own web cache. The only way they could be shared is if you used Argo Smart Routing with Tiered Caching.

But every edge cache might not be exclusive to one Country.

There are lots of options here, some depend on your plan.

On an Enterprise Plan, you can use a custom cache key which specifies user geo as part of the key.

More readily available options on self-serve plans are to modify the request URL to include the cf-ip-country as part of the URL (such as in a query parameter). This can be done in a Worker, and probably with the Rules URL Modification feature (I haven’t tested this use case). If you modify the URL this way, the cache key will include the Country code in the URL.

1 Like

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