Cloudflare full page caching – part 1

WordPress is a great CMS, really powerful and flexible. But the downside that comes with that is that is can be rather slow, when not properly optimised.  And even if it has been properly optimised, you’re still hitting the database a lot of the time, and this can really slow things down under heavy load.

The way that a lot of performance boosting plugins deal with this is to cache the HTML of each page.  They take the rendered markup, store it locally in a file, and then when that page is accessed again, the file is returned instead of re-generating all the HTML.  This can give quite noticeable improvement.

Cloudflare is a service I’ve written about many times before, and it’s great for caching your website in each of it’s 194+ (and counting) edge nodes, which can hugely reduce latency.  It would also hugely reduce the load on our origin server, as it would not need to process all the PHP in order to generate the content, nor would it need to contact the database for all the settings and content that is held in there.  This means that if we can get Cloudflare to cache our full page HTML then this would be significantly better than anything a WordPress plugin alone could achieve.

However, by default, Cloudflare will only cache static assets, such as stylesheets and javascript, not dynamically generated content from PHP files.  So how can we change this to take full advantage of the Cloudflare network?

What we’re going to do falls into two discrete chunks; firstly we’re going to add a Worker to Cloudflare to perform the caching, and secondly we’re going to install a WordPress plugin to automatically manage the cache when things change.

I’m going to pause here for dramatic effect, and cover these in my next blog post!

If you can’t wait, I’ve covered this in detail in my Setting up Cloudflare and WordPress course, available on Skillshare and Udemy.

PHP error reporting

I’m self-taught when it comes to PHP, which is probably how a lot of people get there with a lot of languages these days, but what I mean is that I’ve never had any formal training on it and I’ve never worked with it commercially.  Most of my experience with it at the moment is…

HTTP/3 with Cloudflare

It doesn’t seem like HTTP/2 has really been mainstream that long, but along has come HTTP/3, brand new and bleeding edge. HTTP/2 itself is much quicker than HTTP/1.1 because it allows TCP connections to be multiplexed, meaning more than one file can be sent through the same connection at the same time  (called “streams”).  It’s…

Checking for insecure references

Insecure content is one of those things that can be tricky to find, even though it’s easy to workaround.  Let’s start by being clear about what we’re talking about. Insecure content is when your website itself is using HTTPS (the address starts with https://) but some of the content links (eg. images, javascript, stylsheets, etc.)…

Removing duplicate styles in Gulp

Almost two years ago, I first talked about adding stylesheets into my Gulp file, as part of the development workflow that I was working on at the time (and still am).  Over that time, I’ve experimented further and wanted to update you on the settings I use these days. Back then I was using Gulp 3,…

Cloudflare WARP

Cloudflare originally announced WARP back in April, calling it “A VPN for People Who Don’t Know What V.P.N. Stands For”.  That’s Virtual Private Network, in case you’re wondering.  Well last week they announced that it was finally here! I had already downloaded the 1.1.1.1 app, but I made sure it was up to date and switched on…