Cloudflare workers to cache WordPress

I am trying to use cloudflare workers to cache WordPress HTML. Is there any optimal way to do it (let’s just avoid APO for a moment) any extra settings would be appreciated.

I am using this snippet of code

Thanks

I prefer this one:

@sdayman thanks a lot

Can that be used by steps mentioned in this guide

Many people didn’t mention about kV in there guide but why use kV

The way I do it is to edge cache my html in a KV (key is the url, value is the html), and use the KV metadata for version control of each page. You also need a Wordpress plugin to control cache purging.

If I was starting out now I’d probably just use APO. Building my own was an interesting exercise which let me customise it to my site and learn about workers, but I did it before APO came along which is a far simpler plug and play option.

This article is also helpful for showing how APO works as a basis for building your own version.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.