I’m building a static hexo website using following scheme:
example.com → site.pages.dev
static.example.com → static.example.workers.dev → example.r2.cloudflarestorage.com
I find that each visit of my site triggers workers & r2 class B operations.
Is there some way to cache response of files like “static.example.com/example.jpg” ?
note: I’m using worker js file in official documentation with http authentication.
You can use the Workers Cache API, yes! The cache APIs won’t work on workers.dev, but will absolutely work on example.com.
GitHub - kotx/render: Cloudflare Worker to proxy and cache requests to R2 is a great example of combining R2 with Cache. And then https://developers.cloudflare.com/workers/runtime-apis/cache/ is the documentation for cache specifically.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.