These days, having a website for your business, online store, app, etc., is practically required. You need it to be up and properly working for the audience whether it is merely informative or your primary source of income. The website places a high priority on delivering content quickly, securely, and effectively, which is why a content optimizer like CloudFlare has become crucial to it.
By replicating a website on a different server and rerouting traffic there, CloudFlare can secure and speed up any website. Although the system is designed to be much simpler to set up and configure, it functions somewhat similarly to a content delivery network (CDN).
In the Content Delivery Network (CDN) market, CloudFlare is not a very new competitor, but they boast that they have more customers than Akamai and Amazon CloudFront put together (a 35% market share they claim, as of March 2018, protecting 7,000,000 websites)! That is a serious assertion!
This tutorial will demonstrate how to quickly install CloudFlare in front of your website to protect it, make it load faster, secure it with a free SSL certificate, and do other things.
Cloudflare? What is it? Do They Provide Hosting Services?
‘Next Generation CDN’ appears to be the name that has stuck for CloudFlare so far, but it is more than ‘just’ a content delivery network. They provide a great set of services designed to enhance and safeguard your website and its visitors from online dangers, even in the most basic (free) plan.
By taking control of your website’s DNS and redirecting all incoming requests through their network, CloudFlare operates. You don’t have to make many changes to your website to activate it; they just protect it instead of hosting it for you.
The visitors to your website (and more importantly, attackers) won’t be able to see and connect to your server’s IP directly if you activate CloudFlare for your website and configure the DNS correctly because CloudFlare sits in front of it and routes requests to your site as if it were hosted on CloudFlare’s servers. This stops attackers from directly attacking your server with a DDoS attack, for instance, on your website.
Cloudflare is not a hosting service, and you don’t have to make any changes to your current website or your hosting. The migration to CloudFlare is just a nameserver change for your domain and then you manage your DNS on CloudFlare’s platform instead of the one you have now (for example ASPHostPortal).
Here are some of the main headlines with services you can activate from the CloudFlare dashboard:
Benefits Using Cloudflare
Here are some benefits if you are using Cloudflare:
1. Protects your website and keeps hackers from accessing your real server.
Cloudflare is able to prevent attackers from directly targeting your real server by assuming control of your Domain Name Service (DNS). All traffic passes through Cloudflare’s network, and by using intelligent analysis and rules, it can determine whether a particular visitor is a legitimate user, a hacker, or a robot and take appropriate action.
2. Provides a free SSL certificate installation, maintenance, and updates for your website.
Your website will get a free universal SSL certificate from Cloudflare, and it will be automatically updated. This means that even without you having to install and maintain an SSL certificate on your own server, all traffic between your website and your visitors will be securely encrypted and shielded from eavesdropping.
Google began to give SSL-enabled websites slightly higher rankings last year, and the company now views “https” rather than “http” as the industry standard. That is exactly what the free SSL certificate from CloudFlare does, and it is completely pain- and cost-free! Just make sure that, after activating CloudFlare, the root URL of your website is changed to use https:// rather than http:// for all requests.
3. Limits or challenges suspicious visitors to protect website from attacks.
Depending on your preference, CloudFlare can detect suspicious traffic or IP addresses with a bad reputation and either ask visitors to verify that they are human visitors and not bots by displaying a challenge page or block them from accessing your website for a specified amount of time. You can modify your security settings and even activate the extremely strict “I’m under attack!” mode. Additionally, you can use the IP firewall to whitelist or blacklist different IP addresses, create rules for a Web Application Firewall that verifies the accuracy of browser headers, and more.
4. Accelerates traffic by using caching
The content from your website that can be cached on CloudFlare’s network is automatically identified, and this content is then served to visitors from ‘edge’ locations more quickly. These are the global Cloudflare servers that store your static content so they can serve it to your customers from the location that is most convenient for them, accelerating access and conserving bandwidth.
From your account’s statistics dashboard, you can see how many requests have been fulfilled from the cache and how much bandwidth they are saving you.
5. Increases loading speed by minimizing static scripts and compressing files
Your static script files (like.js and.css) can be minified by CloudFlare, which reduces their size by removing whitespace and newlines. Your images can also be optimized and compressed to make them smaller and load more quickly. Check out the other speed-related services in the ‘Speed’ section to activate them; some of them may not be free.
6. Track your visitors
Cloudflare will provide you with details about your visitors, including their numbers, origins, and threats. They also boast more analytics than standard services (like Google Analytics).
Steps to Enable Your Cloudflare Account
Let’s start with a free account and work our way up from there. There are many more services you get and can activate for specific fees based on usage.
1. Create your Cloudflare account
2. Add your website to Cloudflare account
After you have successfully registered, you can now add your website on your Cloudflare account. Please see below:
Click “Scan DNS Records” after entering your domain name (without the www).
Do not be concerned; this will only scan your DNS and display the records it finds; it will not yet make any changes to your website or DNS. Your website won’t actually change until a few steps later.
3. Check your DNS records
You are given a screen that looks something like this after a brief period of time. What’s interesting about this table is the status column, which displays which domains and subdomains are forwarded through CloudFlare’s network and which ones are left to pass through and directly hit your server.
To change the setting and force all traffic to go through CloudFlare’s network, click the grey cloud icon if you don’t have any particular services or applications that require a different DNS access. This will guarantee that your server is secure. There won’t be any effects on the active services.
Verify that each domain name and subdomain is present. On a few occasions, I discovered that CloudFlare either couldn’t read or had “lost” one subdomain, which prevented the application that was hosted on that subdomain from working after the migration. It was a simple fix that involved adding it directly to CloudFlare’s DNS, and within a few seconds it was operational again.
4. Select your plan
You move on to choosing a plan after making all of your DNS routing decisions.
Some services may or may not be offered depending on your plan, while usage-based fees may apply to other services.
But for the time being, as we’ve already stated, we’ll stick with the free plan, which has a lot to offer.
5. Change your name servers
This is the step where things are actually turned on and where traffic is forwarded through CloudFlare’s network. It entails switching the nameservers from the default ones provided by your registrar to CloudFlare’s.
The nameservers that are currently associated with your domain name are shown by CloudFlare, along with suggestions for replacements.
You can ask your administrator if you don’t have access to your domain’s management interface with your registrar.
CloudFlare will not work until you make this change. So, in order to make changes, you need to login to your domain portal registration and you can point your domain to Cloudflare name servers above.
As an example, I’m using ASPHostPortal, so I just need to login to domain portal registration and change name server settings like below:
Then, you just click update name servers and give the DNS change a few minutes to take effect.
If everything goes according to plan, you should be able to access the domain name by refreshing your CloudFlare account a short while later.
It’s also a good idea to try browsing your website right now to see if everything is still working properly.
The website gave me errors for a minute or two, but after that everything was fine.
Additionally, according to CloudFlare, SSL certificates may take up to 24 hours to fully activate. As a result, if your website doesn’t already have an SSL certificate installed, I would recommend waiting until the following day to change all requests to https so that the CloudFlare SSL certificate has time to be properly installed and propagated across all endpoints.
Conclusion
I advise trying the free tier of Cloudflare. It was simple to set up and in this instance definitely improved performance.
Not to mention, we only evaluated its speed-related components. But Cloudflare also serves as a security perimeter. Additionally, it can maintain an offline copy of your website even if the origin server is down.
And Cloudflare has a paid plan as well, should you ever decide to use it to its fullest extent. Numerous additional features, such as WAF, image optimization, mobile optimization, etc., are available on its paid tier.