Content Delivery Network with Cloudflare

How to Speed Up Your Website using Cloudflare Content Delivery Network (CDN)

Disclosure: Some links may be affiliate links. If you buy an item via links on our site, we may earn a commission. Learn more.


Having a fast loading website is important. Not only will your audience have a better experience when they visit your site, speed also has an impact on your SEO rankings. A slow site can negatively impact your traffic and page views, conversions, as well as your brand image can also be adversely affected. It is vital that you should always try to optimise your sites speed.

There are a number of options to reduce those extra seconds that it may take your site to load. These can include anything from using a caching plugin such as WP Super Cache, removing unnecessary plugins, optimising your images, using a lightweight theme, upgrading to better web hosting etc. A simple but effective way of improving your sites speed is by using a content delivery network (CDN).

In this article we will explain what a CDN is, the benefits of using one for your site, and we will show you how to add your site to Cloudflare’s CDN.

What Is a Content Delivery Network (CDN)

A content delivery network (CDN) is a network of servers that are distributed around the world. Depending on a visitor’s location, the CDN will load a website’s content from the server that is closest to them, therefore delivering content more efficiently to users.

If you’re not using a CDN, your site will load from your web host’s central server irrelevant of where the visitor to your site is geographically located. For example, if your web host’s server is based in California and someone visits your site from Australia, the content will still be loaded from the server based in California. For users who are located furthest away from hosting servers, page load times can be impacted as the information has further to travel. If your site is also hosted on just one server and it experiences high levels of traffic, the time to process each request can increase and users will experience slow load times.

Source: Cloudflare

With a CDN, these issues are eliminated. A CDN will cache your sites content including CSS, JavaScript files, images, videos and other content and store these on servers located around the world. This will reduce the bandwidth and load as the files are not being requested directly from your server. Also, as the server closest to your user is delivering the web content, there will be less latency and your site should be much faster.

Benefits of Using a CDN

The main benefits of using a CDN include the following:

Improved Speeds

One of the main benefits of using a CDN is speed. Users will experience faster loading times and therefore this should improve conversion rates and also reduce bounce rates and over time your visitor numbers should increase. Not only will this have a positive impact for your visitors, it may also be beneficial for your search rankings. Search engines use page speeds as a key ranking factor.

Increased Security

Using a CDN can also improve your sites security. Many CDN providers offer a number of features which can help to prevent Distributed Denial of Service attacks (DDoS) as well as hotlink protection and protecting against other common cyber-attacks.

Better Reliability and Performance

As content is cached and stored on servers located around the world, this brings the content closer to your users meaning reduced latency and less loads on the origin server. It also minimises downtime as if one CDN server goes down due to a hardware failure for example, the request will automatically be re-routed to another operational server which ensures the site is always available.

Reduced Costs

As CDN’s are serving static content from their servers, this reduces the amount of data and bandwidth consumed from the client’s origin server and this therefore reduces costs on web hosting.

How to Install Cloudflare CDN for Your Site

There are a number of premium and free CDN providers out there. Some of the most popular ones include MaxCDN, KeyCDN, Amazon CloudFront and Cloudflare.

We would definitely recommend using CloudFlare. Setting your site up on Cloudflare is a quick process and it has an easy to use site. Best of all Cloudflare is free. It does have a premium package although the free package should be suitable for most users. The free package comes with unlimited bandwidth.

See the following steps on how to set-up your site on Cloudflare, I’m sure you won’t regret it.

Step 1: In order to use Cloudflare, you need to set-up an account with them. In order to do this head over to Cloudflare and click on Sign Up and enter your email address and password.

Cloudflare

Step 2: You will next be asked to enter your domain that you want to add to Cloudflare. Once you have added your domain (there’s no need to include “www” or “HTTP”/”HTTPS”, the root domain should suffice), click on the Add Site button.

Step 3: Cloudflare will now scan your domain’s DNS records. The scan should take approximately less than a minute to complete. Once the scan has completed, it will display a list of the DNS records that have been found including the subdomains.

Review and enable the relevant entries that you want to go through Cloudflare and be cached. In order to enable an entry click on the cloud icon, orange is active and grey is disabled. Anything related to email, you will probably want disabled.

Once you have reviewed and enabled/disabled the relevant entries click Continue.

Step 4: Cloudflare will next ask you to select a plan. The Free Website plan should be sufficient for most users. If you require any additional features which the free plans doesn’t offer, you will need to select the plan that suits your requirements. Once you have selected the plan, click on Confirm Plan.

Cloudflare

Step 5: Next, Cloudflare will provide you with the Cloudflare nameservers for your relevant domain. You will need to update the nameservers on your DNS registrar.

For example if your domain is registered at GoDaddy, you will need to perform the following steps:

  1. Log into your GoDaddy Account Manager.
  2. Next go to the domain, click on the Manage
  3. Find the relevant domain and click on the Gear icon and then select Manage DNS.
  4. Next, scroll down to the Nameservers section and click on the Change
  5. Enter the namerservers that Cloudflare provided you with and click on Save.

Nameserver updates are not instant, they can take up to 24 hours to fully propagate. Your site won’t suffer any downtime during the switch to Cloudflare if it was already live.

Once you see Status: Active appear in the Overview tab, it will mean the nameserver change has completed. Load your site and ensure it works.

Step 6: Your site has now been added to Cloudflare. We would recommend however that you also make the following changes in order to get the most benefit of using a CDN.

Select the Speed tab on the Cloudflare site, under Auto Minify enable Javascript, CSS and HTML. Auto minify essentially reduces the size of these files so they load faster by taking out whitespace, code comments, and unnecessary semicolons.

Cloudflare

Under Enable Accelerated Mobile Links, ensure both entries are enabled.

Cloudflare

Under Brotli, make sure the option is enabled and ensure this is the same case for Rocket Loader. Please note, occasionally Rocket Loader may cause your images to load slowly. If you notice this is the case for your site, just disable the Rocket Loader option.

Cloudflare
Cloudflare

Step 6: Cloudflare recommends that you also set-up page rules for your site (accessed from Page Rules tab). We recommend that you create three page rules which are shown below:

1. A page rule for your admin section of your WordPress dashboard (replace the URL with yours). We don’t want Cloudflare to cache our WordPress dashboard as we want to see the latest changes that we’re making to our site.

2. Create a page rule for the preview section so that your latest changes to your posts, pages and you don’t see the cached version.

3. Create the following page rule, to cache everything on the homepage.

Similar Posts