Workers and cache

I’m using a worker to redirect requests to to an s3 bucket
Images are being caches but every time a request happens the worker is being called is there a way to skip the worker for requests that are cached?

This way I already have 3M requests in workers and will run out of the 10M in just a few days.

1 Like

There’s no way to skip a worker if a request is already cached.
Here’s a detailed answer that explains why that is not possible: Cache in front of Worker - #8 by KentonVarda

Thanks for the reply! I think I understand now.
So basically what I’m doing with workers/cache is the way it’s supposed to work and I should just assume I have to pay the cost for what’s being delivered.

Workers are indeed very fast, and I’ve had no issues so far except that some files that I’m server could be cached but are marked as dynamic. (some very tiny zip files)

Workers will respect the origin cache headers, but can clone the response work with new headers of taste, and cache that response. No longer showing the Dynamic.

I have these settings added to the request but nothing changes

options.cacheTtl = 31556952
options.cacheEverything = true
return fetch(zipRequest, options)

am I doing something wrong here?

You have two cache mechanisms, the fetch cache and the response cache. It looks you are just using the fetch cache.

Where can I find more information about response cache? Should I just set the headers on the Response object or is there an api for that as well?

Have a look at this example: