After a long odyssey of messages with Cloudflare’s support I now got a confirmation: Using the cacheTTL option is inherently dangerous, because makes the worker cache everything, including 5xx responses. So if your origin server ever returns a single temporary “503 Service Unavailable”, it will not affect a single user but it will be served to all subsequent requests, effectively taking your site down. I was asked to upgrade to the “Enterprise Plan” to solve this design flaw.
I always lol when the suggestion of Enterprise Plan is mooted.
That plan surely is only for a very thin slither of users who websites make serious profit.
The vast majority of websites are passion projects and will never (in a million years) generate enough profit to afford going Enterprise.
Did you try to using Respect Existing Headers
I think that option will not use browser cache so it will update on header from server, mean it will not effect to all visitor.
I use this approach avoiding the need for an Enterprise plan.
...
let newHeaders = new Headers(response.headers);
newHeaders.set("cache-control", "public, immutable, max-age=86400");
response = new Response(response.clone().body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders
});
if (response.status === 200) {
event.waitUntil(cache.put(event.request.url, response.clone()));
}
return response;
Pls are you very experience on worker configuration, I need help and i will pay for it pls. Whatsapp me on +447446009899, Many thanks