Help needed with Edge cache and Workers

caching
wordpress
workers

#1

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: https://cl.ly/3c2267010a4b?fbclid=IwAR1uJM50H2XXE9_EilTcIcP9LvJWvPVFf7cXS276K0JzkOilohpuERPNS74)

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


#2

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


#3

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);

#4

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


#5

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


#6

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?