Getting the Most out of a Free Cloudflare Account
By default, Cloudflare does not cache HTML files. If like me, your traffic is > 50% HTML, that is not making the most of your account. Also, if like me you use WordPress, the HTML pages are slow to create and place a heavier load on your hosting server than a few static images, and css and javascript files. This can result in an analytics graph like the following, with most traffic uncached.
So to get around this you need to set two custom page rules in Cloudflare. Go here to do that:
https://www.cloudflare.com/a/page-rules/yourdomain.com
Rule 1: Pass-through for Admin
First set up a rule allowing access to your WordPress admin interface (adjust for the admin panel of your own content management system if using something different):
Use this as the URL pattern (the first field of the form):
http://yourdomain.com/your_path_to_wordpress_wp-admin_dashboard/*
Adjust the URL to match your own site. Then go through the other fields and turn off all caching. This rule will override the settings for the rest of your site and let you through to change it without caching getting in your way.
Rule 2: Cache Everything Else
Now make a second rule to be an aggressive default. Use this as the url pattern, to match every page on your site:
*yourdomain.com/*
Then set the custom caching drop-down to `Cache everything`. That will let all the static and dynamic HTML pages also be cached in Cloudflare servers all around the world. Now your visitors will be pulling compressed versions of your pages with all the optimisations that Cloudflare apply from the servers closest to them. The result should be a graph more like the one below with lots of cached traffic shown as the orange trace here.
Edit, 19th July, 2017
Just to check the page rules are working I ran a little wget job (with sensible random waits) on this site repeatedly. I configured wget to only request html pages, not images, css, etc. On the left below we see Cloudflare caching the html pages while undergoing this repeated site mirroring.
Just to confirm it is these rules that make the caching of HTML work I reran the experiment with the page rules disabled The mirroring of html causes a big spike in uncached traffic in this case, as shown on the left below.
These two experiments show that Cloudflare doesn’t cache HTML by default but you can easily force it to do so with the simple page rules given above.
This strategy can let you run a high-traffic site off a cheap shared hosting provider. Why not try setting up a website with Bluehost or 1and1 and then turning on Cloudflare with these rules for yourself?