Help needed with Edge cache and Workers

Hi,
I’m trying to implement edge cache as mentioned on:

https://raw.githubusercontent.com/Cloudflare/worker-examples/master/examples/edge-cache-html/edge-cache-html.js

For some reason, most URLs are missing the edge cache (Ex: Image 2019-02-18 at 9.13.24 AM)

Roughly only 5% are getting cached. Can you please help me how to resolve this?

I also need that, can you please provide me too.

For cache is simply this:

In some scenarios you might need to delete some origin request headers:

    const newHeaders = new Headers(response.headers)
    newHeaders.delete('Cache-Control');

And then append:

       newHeaders.append('Cache-Control', 'max-age=' + cacheTime);
1 Like

Thanks.
But I’m specifically looking at edge cache, not basic cache.

With the worker script above, it will be cached at Cloudflare Edge.
Isn’t that what you mean?

Hi,

Apologies if I sound dumb. I’m not a developer, so not sure if I’m expressing my issue properly.
In the original post above, I’m talking about edge-cache-html example and not the basic-cache example as per the instructions from the repo. They seem to be different and I’m not sure if they’re meant to work together, combined, or not. If they are meant to work together, can you please guide me about how to do that?

I am also observing similar behavior where the number of cached request with workers is very less.

Am I supposed to add this worker script and deploy to the existing route? Can you please help with the implementation step?