R2 caching
I am looking into building a plugin for Logseq that allows users to upload and view files from R2.
I am looking through https://github.com/kotx/render to get a better idea of how to setup file read.
in there readme there is the following note:
Note: Due to how custom domains for workers work, you MUST use a route to take advantage of caching. Cloudflare may fix this soon. Also note that *.workers.dev domains do not cache responses. You MUST use a route to your own (sub)domain.my project is meant to be used by different users. I do not want to set a specific domain. Users will be able to configure thier bucket, account, etc.. similar to other S3 storage tools but via the worker API instead of the S3 compatible API. does this mean I can't take advantage of caching? should users configure thier own domain as well for private file viewing? seems unnecssary
GitHub
GitHub - kotx/render: Cloudflare Worker to proxy and cache requests...
Cloudflare Worker to proxy and cache requests to R2 - GitHub - kotx/render: Cloudflare Worker to proxy and cache requests to R2
1 Reply
It's a limitation of the Cache API:
However, any Cache API operations in the Cloudflare Workers dashboard editor, Playground previews, and any *.workers.dev deployments will have no impact. For Workers fronted by Cloudflare Access , the Cache API is not currently available. Only Workers deployed to custom domains have access to functional cache operations.https://developers.cloudflare.com/workers/runtime-apis/cache/ I don't really understand your setup though. If you're saying your users will upload their own Workers, then they will need to use a Worker Route, or Worker Custom Domain, to hook up their worker on a custom domain to use caching.