I first heard of Cloudflare during my migration from Wordpress to ghost. You can use Cloudflare's service to act as a virtual (shared) SSL certificate for your domains, saving you the cost of buying or managing your own. Cost savings - YAY!
What I didn't appreciate were the other benefits that using Cloudflare provides.
PLEASE NOTE: I know what DNS servers do, but I may use a little bit of techy license in this description to make it easy for everyone to understand. I apologise in advance, but don't let that stop you from beating me up in the comments section if you feel it's necessary.
One of the very important jobs that DNS servers do is to convert text-based addresses that are easy for humans to understand and remember (e.g. funnelvision.com.au) into IP addresses that are easier and more efficient for machines to use.
My personal preference is not to use the 'www' prefix as the default address on my blog sites. This is why the page address above , and all addresses on this site, starts with "funnelvision.com.au" and not "www.funnelvision.com.au".
For hosted services such as ghost(Pro), this can be a problem as my domain name is mapped onto the site using a "CNAME" record in the DNS server that tells the world:
If you want funnelvision.com.au, it's wherever funnelvision.ghost.io is
This is as opposed to specifying (with an 'A' type record) which IP address funnelvision.com.au refers to. You typically do this when you have your own server.
According to the spec, CNAME records are not permitted at the apex (root) of the domain name, but only for sub-domains. There is probably a perfectly valid explanation for this (Cloudflare kindly provide their own), but this can be a pain when working with hosted services that normally don't provide IP addresses to map 'A' records to.
Fortunately, Cloudflare's DNS service also does something called CNAME flattening, which gets around this limitation - YAY! This means you can use the apex of your domain name as your ghost(Pro) blog name. The same would be true of any hosted service (e.g. Zendesk) that relies on a CNAME configuration pointing to a native domain name.
In order to take advantage of all these DNS-based features, it's necessary to make Cloudflare your designated name server for the domain. As it turns out, this is a blessing as, once again, it's saved me money compared to the cloud-based service I was using before without any loss in control. YAY again!
Content Delivery Network (CDN)
One of the other things Cloudflare does is manage a Content Delivery Network or CDN.
CDNs are networks of servers designed to optimise the delivery of content to browsers.
This has the effect of making your website appear faster to the end user/system requesting content. It reduces the strain on your server (because the content is served from local caches on the CDN).
If you're using a cloud-based service that charges per bit, it also reduces your costs because you're not serving the data from your own datacenter, but from a globally distributed network of servers. More cost savings - YAYAYAY!
NOTE: I'm not sure how much I'm benefitting from the CDN on the free plan, so please check yourself if this is important to you.
So, we have the SSL cert in place, the CNAME flattening to the domain apex (no sub-domains required), and (maybe) a faster delivery, but what else can Cloudflare do?
Well, the site works perfectly well at the domain apex. But, I realise that a lot of people still automatically add the 'www' sub-domain to website addresses and this was not yet catered for in my setup.
Cloudflare's DNS service has already proved itself, and I could create a CNAME entry pointing the 'www' sub-domain to ghost, but ghost only allows one mapping of your domain name and I'm already using that for the apex. Using the same setup for the 'www' sub-domain leads to the ghost fail page.
The only option is to create a redirect from wherever the 'www' domain lands back to the apex, taking into account that we want to retain any path information (the page-level bit after the domain name) so browsers are redirected to the correct page.
One option is to have the sub-domain point to another web server that you happen to have lying around. This is configured to serve a 301 redirect that pushes the browser back to the apex (and the ghost-hosted site).
Alternatively, you could use Cloudflare's Page Rules. Because Cloudflare is acting as your name server for the whole domain, all non-cached requests for any page need to come via their servers. What Page Rules do is intercept matched requests (i.e. to the 'www' sub-domain) and issue that redirect for you. Easy and elegant.
If you haven't guessed, I'm a BIG fan of Cloudflare and wish I'd found it sooner. My only concern is that all of this functionality comes for free. I feel almost guilty saying it - like I'm taking advantage and shouldn't be encouraging others to do the same! This post is, in some small way, a token of my appreciation.
I will, nevertheless, be migrating all my sites away from my current DNS service into Cloudflare, and strongly encourage anyone who is running a blog to consider the ghost(Pro)+Cloudflare option. I hope that I may one day repay them by having cause to upgrade to a premium plan.
Yes, the services I've described are all basic, free services, but Cloudflare also offer a range of more advanced services through their premium plans.
If you have a high-performance website that needs security and reliabilty, I urge you to consider Cloudflare.
Questions & Help
If you're unclear about how Cloudflare can improve your website, or you're interested in migrating your sites and need some help, please get in touch. Or, use the comments section below.
Thanks for reading.
Image: Cloudflare's network, taken from Cloudflare.com