Workers Caching

Hey, I’m using a worker to serve protected assets. The problem I’m facing is that the cache-control headers I’ve set aren’t being applied, so the responses aren’t getting cached as expected. I’m trying to figure out whether this is happening because I don’t have a custom domain configured, or if caching should work without one. Could you help me understand what I might be missing?
2 Replies
SuperHelpflare
Workers run in front of the Cloudflare Cache layer. This means it's not possible to avoid invoking a Worker by using the Cache. If you want to cache things between Worker invocations, you can use the Cache API to store and retrieve data from the Cloudflare Cache (which is local per colocation). For global data/cache storage, you may be interested in Workers KV instead.
Tushar
TusharOP7d ago
okay so that means we have to integrate it with the Cache API too no cache control headers work? okay got it thanks

Did you find this page helpful?