Issue with caching when accessing r2 using Cloudflare Workers

I’m trying to access r2 through a Cloudflare worker at this URL: https://worker-cache.cfm.moe/qiaoshouzi.png. However, I can’t find the CF-Cache-Status header in the response. The Real-time Logs show that the request has been made successfully.

On the other hand, when I access r2 using a custom domain, such as https://r2-cache.cfm.moe/qiaoshouzi.png, the CF-Cache-Status header is present in the response.

How do I get Cloudflare to cache worker requests.

Workers always run in front of cache. You can use the Workers cache API to speed up response times though:

If you want a good example Worker for handling R2 with cache, Range, etc. render is great:

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