Caching tricks with Cloudflare Workers
dev.to
dev.to
In that case, you could change the fetch() call to:
response = await fetch(newRequest);
And then make sure you set a page rule to "cache everything" on your whole site (otherwise by default HTML won't be cached since it's often dynamic).Then you can remove the explicit `cache.match()` and `cache.put()` calls from this example, since the `fetch()` call will implicitly perform the caching you want.
(I'm the tech lead of Cloudflare Workers.)
You're right however, a simplified version probably works for 99% web servers (as long as the query parameters don't conflict with the ones used by your app), but unfortunately it didn't work for my use case.