On a Cloudflare Pages site on a custom

On a Cloudflare Pages site (on a custom domain), I'm making an API request to a Worker (on a custom domain) via fetch(), with cache everything and cachettl set. The response object has some Cloudflare headers on it - cf-priority, cf-ray, server - but no CF-Cache-Status. I was expecting to see that to verify if the request was cached or not. What have I missed, please?
3 Replies
Paul Wong-Gibbs
Paul Wong-GibbsOP2y ago
Does my Worker's response need to have caching headers on it, even with cache everything set on the fetch call?
Walshy
Walshy2y ago
Workers run before cache You cannot cache a Worker response You can access the cache through the Cache API though
Paul Wong-Gibbs
Paul Wong-GibbsOP2y ago
Ok. Trying to understand. Pages itself runs on Workers, so inside that when I call fetch() to my Worker, that’s before the caching layer. https://developers.cloudflare.com/workers/examples/cache-using-fetch works because I’m hitting the worker directly, and not through another worker?
Cache using fetch · Cloudflare Workers docs
Setting the cache level to Cache Everything will override the default cacheability of the asset. For time-to-live (TTL), Cloudflare will still rely on …
Want results from more Discord servers?
Add your server