I have a worker which is triggered by a CDN url, let’s call it Url-A.
I create a new request based on the URL to my underlying service, this is Url-B. I call Url-B with a fetch request. My service always redirects (303) to Url-C, which gives the file response.
I got the response from CDN, the redirect is followed correctly, but it is always a cache MISS.
My assumption and what I’m trying to achieve is this:
- Cloudflare checks the cache before calling Url-B, the cache key is Url-B
- the file stored in the cache is the response from Url-C
Is it possible? Is my understanding wrong?
return await fetch(request, {
redirect: 'follow',
cf: {
// Always cache this fetch regardless of content type for a max of X seconds before revalidating the resource
cacheTtl: env.TTL,
cacheEverything: true,
},
});