I was working with a customer recently that was using Cloudflare and caching a little over 99% of all requests to their site, before that I think the most I had ever seen was about 25% and my own sites were topping out at only around 14% cache hit ratios. Knowing how my site was already streamlined and very static I set out to see how I could improve on this cache hit ratio with my Cloudflare account, which is simply the free tier as I cant seem to justify the cost of their paid plans.
After reviewing all of the caching settings and enabling the Edge workers with this handy plugin I then began to look into the Page Rules. And by looking into them I mean I ended up reading about a dozen other blog posts for optimal Page Rule setups and came up with the ones below.
Since applying this setup I have already seen an increase to an almost 85% cache hit ratio as shown in the following image.
*I also wanted to make note the first rule is in place for security rather than performance if that was not clear.
The Edge workers that I had enabled with the previously mentioned plugin are also providing some further insight on the cached requests that are being served.
I assume this will only increase as time goes on and I stay out of the backend of my site. I also came across this site which will check a URL for a Cloudflare cache hit. *If you are familiar with the terminal and working from the command line, you could simply use “curl -i” on your site twice to see if it missed or hit the cache. Look for the cf-cache-status header.
*May 11th, 2020 @ 1:26pm EST – Updated image per a suggestion of moving the cache everything pageful to the bottom.