Hi
I am building screenshot API, and I want to use Cloudflare for caching API responses. But! As far as I understood, I will violate the terms of the service by serving only images from my API domain. However, I proxy all requests to my sites through Cloudflare.
So, I thought, what if I can use workers for fetching and storing API responses in R2 and serve them from it? It should not violate the terms of the service.
But in many examples, I saw workers storing R2 files in the Cloudflare cache and serving them from there. So, I am again puzzled.
Maybe, I can build the following process:
- fetch from the cache;
- if not found, fetch from storage and populate cache;
- if not found, fetch from API and populate storage and cache.
But still, there is the cache issue, that I will use cache mostly for serving images. I am ready to use paid plan, but I did not find any relevant information for my use case.
So, the question is can I use Cloudflare Cache from workers to only store images? Or even to update images in cache from R2? Does not this use case violate the terms of the service?
I know that there is Cache Reserve in the beta, but still, the question will be actual.