Purge Cache for all origins

When I was trying to purge cache for a JSON file, it was not cleared.
On further research we found that we should add the Origin header to the purge request to clear the cache. Since we have multiple origins accessing the same file, it is hard to keep track of all the origins accessing the file. Is there a way to purge cache for all origins for a file from a single URL ?
Please suggest an alternative for this.

1 Like

You would need to use “Purge Everything” in this case if you don’t want to issue a single file purge for each origin header.

The alternatives would be Custom Cache Keys or Cache Tags which are Enterprise features:

https://developers.cloudflare.com/cache/how-to/purge-cache

Purging everything is not a good solution as I have a large number of files, and purging everything when one of these files change defeat the purpose of using a CDN.
I think this is a valid use case for a CDN.

1 Like

In this case, you would need to use the cache keys or cache tag features.

If these options don’t work for you, you could also code your own solution using Cloudflare Workers & the Cache API - this would allow you to cache via a key that doesn’t include the origin header.

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