19/03/2018 by EAC Directory 0 Comments
Useful Tips on Cloudflare
CloudFlare is a content delivery network and distributed domain name server service that helps accelerate a website’s load speed, save on bandwidth to your server through a number of techniques and best of all it’s free. Users can also choose to upgrade to a paid plan for additional features.
CloudFlare also helps protect your website against some known online threats and also collects and provides analytical data about your website visitors.
Apart from the basic features provided by CloudFlare, there are yet other ways you can make the most out of the service as highlighted below:
Access to SRV, SPF, LOC and AAAA records
Unless you are running on a VPS or dedicated server, gaining access to the likes of SRV, SPF, LOC and AAAA records on a shared hosting account is never guaranteed and if you must have access to these zone records for online services such as Microsoft Office 365 and Lync to properly work on your domain name, chances are you will have to pay a fee to get your host to set this up for you.
But why incur any additional expenses from your host while you can set these records up on your free CloudFlare account? Simply navigate to the DNS settings of your domain name and from the dropdown menu select the record you want to add and input the details accordingly. Once done, submit the changes at the bottom and you are done.
Hosting subdomains on independent servers
You might find yourself in a situation where you are working on 2 different web applications which require a different server environment to run in but you intend to have them running under the same domain name. This can leave you in a difficult situation but the best option in this case would be to have one application run on a sub domain which you can later on host on an independent server.
How to achieve this is rather simple, first of all you will need to sign up for a CloudFlare account, configure your domain name then point your domain’s nameservers to the one’s provided by CloudFlare.
Secondly, set up your second web server where your subdomain will run from. Configure it to host your primary domain name (eg. example.com) then add the subdomain name of choice say app.example.com. Take note of the server’s IP address or A record.
On your CloudFlare account, under the DNS settings for your domain name, add the subdomain app and point it to the A record of your second server. Confirm changes and within 5 minutes it should start working if everything is configured correctly.
In this scenario we have example.com pointing to the A record of your main server, while the subdomainapp is pointing to the A record of your second server. This works since CloudFlare is the one responsible for resolving your domain name since your domain’s NS record point to it.
You can go ahead and add even more subdomains and host them on different servers using the above method.
Switching to a backup server in no time
If you have a secondary backup server lying around should your primary server go down for one reason or another, having your domain name already configured on CloudFlare will come in as a great advantage.
Often when your primary server goes down, the first thing to do is usually upload the latest backup you took from your primary server to the backup server then point your domain name’s nameservers to the backup server. The only problem with updating NS (nameserver) records is that it will take ages to completely propagate and this beats the logic of having a backup server in the first place since there will be an unavoidable downtime during the propagation period and by the time propagation is complete chances are, your primary server might already be back online again.
Switching back again from the backup to primary server through a NS record update while both servers are up and running is also another daunting task as it brings about a unique problem unless you put one server offline and risk downtime yet again during propagation.
The issue here is that since propagation does not occur uniformly, you can have people from one part of the world still accessing your backup server (where propagation is slow) and another set of people from a different location (where propagation is fast) accessing your primary server all at the same time. If your website runs on a database and you have people transacting in such a situation, then you will most definitely end up with a messed up database which will be another pain to fix.
However, with your domain name running on Cloudflare, should your primary server go down, all you have to do to switch to your backup server is simply change the A records to point to your backup server and it should start working in less than 3 minutes, it’s almost instantaneous since no DNS propagation takes place at all.
URL Forwarding and more page rules
You can configure how a specific URL or URL pattern is forwarded once a user tries to access it from his/her browser. This feature is also available in a standard cPanel under the WWW Redirects option but it is much more superior and does a better job.
I have successfully forwarded a URL that contains query strings of a GET request using Cloudflare and was unable to do the same on cPanel.
You can get the URL forwarding feature under page rules as well as other features such as: custom caching, browser cache expire TTL, performance, rocket loader, security level, browser integrity check among other option.
From all the above features that I have pointed out, it is clear to see the benefits of having your domain configured to run on CloudFlare and best of all all these features are available for free!