Worker Cache API doesn't cache requests anymore

Hi.

I’m caching all the requests that pass through the worker like this

    const cache = caches.default
    response = await cache.match(request)
    if (!response) {
        response = await fetch(request)
        event.waitUntil(cache.put(request, response.clone()))
    }

I have some tests that look for the cf-cache-status header after making the same request twice. The header used to appear but now it doesn’t anymore.

1 Like

Fetch needed the cacheEverything option

fetch(request, { cf: { cacheEverything: true } })

I’m also experiencing this. This is erroneous behaviour though. cache.put should cache a request, no matter what

Note the cache respects the cache header of the fetch, or whatever set on the dashboard for cache.