Categories
Internet and Networking

How to Configure Cloudflare CDN (for Free) for Your WordPress Site, and Verify Whether or Not It’s Working

For the uninitiated, CDN (Content Delivery Networks), helps with site speeds. Site speed, in return, helps you with SEO (amongst other things). The popularity of CDN has grown hand-in-hand, with the same growth of the importance on site speeds.

Primarily, CDNs work by storing and caching your assets such as CSS files, JavaScripts, images, etc. over different geographical regions of the world. Say, for instance, someone accesses your website (you being in California) from the following 2 locations below:

  1. Australia
  2. Someone from North Dakota

All things being equal, it will take more time for the person in Australia to load your site than the person in North Dakota. On a larger scale, businesses, blogs, etc. can suffer, simply because Australia is farther. Precisely, this is where a CDN can help! They can store your assets (a.k.a on a CDN network) in a location that’s closer to a geographic region (in our Example, Australia), so when that person goes to your site, a lot of the assets are loaded directly from the CDN, as opposed to sending requests all the way to California. Distance matters! Imagine how much beneficial this may be for video streaming services such as Netflix, or social media sites such as Facebook!

How to Configure Cloudflare CDN: Getting Started!

The first and foremost action item you’d have to take is to make a Cloudflare account, add your domain, and change name servers. Frankly, it’s very effortless! And if you’re one of those visual learners, check out the video below from Cloudflare themselves!

Source: https://www.cloudflare.com/learning/cdn/what-is-a-cdn/

You May Also Want to Check Out:

What You Need to Do in WordPress

Step 1

Once all of the basic fundamental setups have taken place, all you have to do now is to go in WordPress, and install the “Cloudflare” plugin. Screenshot below for reference.

installing-cloudflare-plugin

Step 2

Upon Activating, and or going to the plugin settings, the first thing you’d have to do is to enter your email account associated with Cloudflare, and get your global API key. To grab that:

  • Log-into your Cloudflare account.
  • Go to Account home.
cloudflare-account-home
  • Enter your site
cloudflare-account-home-click-site
  • Next, scroll all the way down, or simply search for “Get your API token”
  • Lastly, on the page that loads next, you’ll see your Global API Key. Hit on view, button, copy the key, and go back to the plugin in WordPress, and plug the key in.

For the plugin settings, it is recommended that you:

  1. “Optimize Cloudflare for WordPress” (Hit Apply)
  2. And turn on “Automatic Cache Management.”

How to Verify That Your Newly Installed Cloudflare CDN Is Working?

There are 2 methods through which you can verify. Both methods should give you the assurance, but method 2 is more accurate (so to speak).

Method 1 (Cloudflare’s Analytics Dashboard)

Log into your Cloudflare account, and go the analytics dashboard. If you’re noticing numbers for things like total requests, Cached Requests, it is said that the CDN is working. See screenshot below for reference:

cloudflare-analytics-dashboard
If you’re noticing numbers for total requests, especially cached requests, you’re golden!

Method 2 (Using https://www.webpagetest.org/)

  • Go to https://www.webpagetest.org/
  • Plug-in the URL you want to test.
  • Once the test is finished, navigate to the “details” tab, and scroll down to the “Request Headers” section.
testing-cloudflare-cdn
click details, and scroll down to “request headers”
  • In that section, expand any of your CSS files (just to test). Expanding will open request headers, and response headers.
  • You’ll go to the second one. Specifically, you’re looking for “cf-cache-status: HIT.” Feel free to exactly search like that. Essentially, if you see “HIT” value for the cache status, it means the CDN is active and working.
cf-cache-status-HIT

To conclude:
1. You can use Cloudflare CDN for free, on your WordPress site.
2. You can also verify if it’s working, via 2 basic methods listed above.

Expert Resources

  1. https://www.cloudflare.com/learning/cdn/what-is-a-cdn/
  2. https://moz.com/ugc/how-to-get-cdns-to-play-nice-with-seo