I m confused it seems to be possible to

I'm confused, it seems to be possible to either purge by key locally or purge all assets globally. Is it possible to purge by key globally?
15 Replies
Cyb3r-Jak3
Cyb3r-Jak33y ago
Currently, it is not possible to purge a URL stored through Cache API that uses a custom cache key set by a Worker.
Your best bet is global purge but you can do by hostname
DaveJ
DaveJOP3y ago
Is it possible to fan out a request so that it gets executed on all edge nodes? Perhaps that is what I want because then I can manually purge just the cache key that I want to purge.
Cyb3r-Jak3
Cyb3r-Jak33y ago
From my understanding that purge url is for all nodes where as the cache.delete in on the same datacenter
DaveJ
DaveJOP3y ago
What do you mean by the "purge url"? You mean this URL https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache
Cyb3r-Jak3
Cyb3r-Jak33y ago
Yeah sorry using the API url
DaveJ
DaveJOP3y ago
I thought you were saying that the URL above is for the web CDN cache. While the internal worker cache API is a completely separate mechanism?
Cyb3r-Jak3
Cyb3r-Jak33y ago
I misread the docs
DaveJ
DaveJOP3y ago
Are you sure? Because after reading the docs I think that you were correct before.
DaveJ
DaveJOP3y ago
This seems different https://developers.cloudflare.com/cache/ to the cache API in workers
Cache · Cloudflare Cache docs
Cloudflare makes customer websites faster by storing a copy of the website’s content on our servers. Caching static resources at Cloudflare reduces your server load and bandwidth, with no extra charges for bandwidth spikes
Cyb3r-Jak3
Cyb3r-Jak33y ago
https://developers.cloudflare.com/workers/learning/how-the-cache-works/#purging-assets-stored-with-the-cache-api
To purge an asset globally, you must use the standard cache purge options. Based on cache API implementation, not all cache purge endpoints function for purging assets stored by the Cache API. All assets on a zone can be purged by using the Purge Everything cache operation. This purge will remove all assets associated with a Cloudflare zone from cache in all data centers regardless of the method set. Available to Enterprise Customers, Cache Tags can be added to requests dynamically in a Worker by calling response.headers.append() and appending Cache-Tag values dynamically to that request. Once set, those tags can be used to selectively purge assets from cache without invalidating all cached assets on a zone.
DaveJ
DaveJOP3y ago
Yes, I've seen this. I'm not sure how that changes anything? Sorry about the back and forth, I must be missing something.
Cyb3r-Jak3
Cyb3r-Jak33y ago
The middle part. Regardless of the method set includes cache API
DaveJ
DaveJOP3y ago
Sure, but that is just a button on the Cloudflare UI that deletes everything from the cache. I want to just delete a key but delete it from all edge nodes. The API URL (https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache) still seems to delete from the Cloudflare CDN not the workers cache.
Cyb3r-Jak3
Cyb3r-Jak33y ago
I don't think that is possible
Currently, it is not possible to purge a URL stored through Cache API that uses a custom cache key set by a Worker
Hello, I’m Allie!
The CDN cached is the one called by the Cache API
Want results from more Discord servers?
Add your server