Purge cache on Pages workers
I am using fetch and the Cloudflare cache API to cache some content. The problem is that I'm unable to figure out how I can purge that cache. I've tried two things:
1. The Cloudflare UI (Caching -> Configuration -> Purge Cache -> Custom Purge_
2. Posting the URLs to Cloudflare API (https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache)
Neither seems to invalidate the cache for me. The URL that I'm trying to invalidate is a GET request to the GitHub API.
3 Replies
Hi @daveje if you set a tag then you can do a tag purge.
If you didn't (or can't) then a full purge is probably required
Hey @veerooo , thanks for your help! Is there something different about the cache for Pages? I was able to purge the cache by URL using the API on standard CF workers (i.e.. outside of CF Pages).
Does it use a different zone or something?
Cache isn't technically different between the two
Cache API doesn't work on workers.dev but does on pages.dev, but the actual implementation is the same (since we're just Workers). What zone the cache is done over... well, that'll either be the custom domain for Workers or the pages.dev for Pages