Cloudflare is a service that can be used to improve the performance of websites, helping them to load more quickly for users. In this article I help you answer the question of whether you should use the free service that Cloudflare offers, as well as helping you get it set up with your WordPress site.
Introduction to Cloudflare
Cloudflare offers a free Content Distribution Network (CDN) service, along with additional paid for services.
Without a CDN, all your site’s content is hosted on just your web hosting account.
With a CDN, static content from your site is hosted on multiple servers all around the world.
Delivering content across the internet takes time, the amount of time increasing the further it has to travel.
So if your site content is hosted in Newark and a visitor is located in New York, your content is only travelling about 10 miles. For a visitor in Santa Monica, your content has to travel about 2,800 miles. While data travels across the internet at incredible speeds, there’s a big difference, relatively speaking, between the amount of time the data takes to travel to the two visitors.
So when you use the free Cloudflare service, their network has an edge server in Los Angeles and now your data only has to travel about 15 miles to Santa Monica.
In practical terms, the time difference may be very small, measured in hundredths of a second or perhaps one or two tenths of a second. Data in fibre optic cables can travel around the equator five times in a second, though on the real internet, there will often be minor bottlenecks to slow things down.
Namely that the increased amount of time taken to retrieve the page via Cloudflare, may be longer than the time saved by serving the static files from Cloudflare. I’ve read several articles where site owners have claimed this has been the case for their sites. Of course that may have been down to poor configuration issues on their part
If your visitors really are spread all around the world, more remote users will probably enjoy faster load times, but if most users are relatively close to your web site’s server, that may not be the case.
I’ve not used Cloudflare for my own sites, but have had limited experience with a customer site using the free Cloudflare service. This is purely anecdotal, but I was surprised by how often I saw Cloudflare’s error page that indicates a problem with the original site failing to load.
When doing more research on Cloudflare for this section, I found a post by a site owner who was receiving several notifications a day from the service monitoring their site for down time. They claimed that as soon as they stopped using Cloudflare’s free service, they stopped receiving the notifications that the site was unavailable.
In fairness, these possible issues relate to the free Cloudflare service and I should also make it clear that I’ve encountered reports of site owners delighted with the results when using free Cloudflare with their sites. So there are two sides to this story.
Cloudflare’s pricing page describes their free service as being “ideal for people with personal or hobby projects that aren’t business-critical“. I think most people would think it acceptable if a personal or hobby site wasn’t quite always available.
It’s also worth noting that previously on their pricing page the free service was described as Fast, while the Pro service was described as Faster. That’s no longer stated, but the Pro service does enjoy optimizations not applied to the Free service.
According to the saying, there’s no such thing as a free lunch. In the right circumstances and properly configured, it appears Cloudflare’s free service can improve the speed of your site. However, it may not be the right choice for the owners of business sites.
Personally I would concentrate on implementing the other suggestions in this Performance section, rather than adding another layer of complexity. So focus on caching pages, optimizing images and removing unnecessary files from pages. A change of web host could also make a big difference. This will give you the opportunity to familiarize yourself with your site and performance.
If you find you have real concerns over the load times your users are experiencing, when revenues allow you could look into adding Cloudflare’s Pro service or one of the other popular CDNs.
However, in case you want to try implementing the free Cloudflare service, we’ll quickly look at how to activate and integrate it with your WordPress.
How to setup Cloudflare free
You can sign up for a free Cloudflare account at https://dash.cloudflare.com/sign-up. When you have your account, log in to Cloudflare.
On the home screen, click the Add Site button.
On the next screen, enter the domain name of your site. I’m using the domain pincatbuilder.com. Then click the Add site button.
On the following screen, click on the Free Plan to select it and click the Confirm plan button.
Cloudflare will then spend a few moments scanning your existing DNS records and making a copy in your account. When it completes copying the records, scroll down and click the Continue button.
A new screen will now load listing the nameservers that your domain is currently using. You will need to login to your registrar’s account and delete these first. You will then need to copy the new nameservers from this Cloudflare page and add them to your registrar’s account.
I’m assuming your domain is registered with Namecheap. If not, you will need to follow your own registrar’s guidance to cover this.
Log into Namecheap and click the Manage button of the domain you’re setting up.
This will open the Domain tab of your domain. In the Nameservers section, set the dropdown control to Custom DNS. If you have existing records added, just highlight each one and delete them with the backspace key on your keyboard. Now enter Nameserver 1 and Nameserver 2 from Cloudflare. Finally click the small green tick icon to save these new values.
That’s it done. Back in Cloudflare, you could click the Done, check nameservers button, but you’re unlikely to see a success message at this point. It can take hours or more for this process to complete. Best to wait for Cloudflare to send you an email to say it has completed as they will keep checking for you.
Once you get that email confirming the new nameservers are set, there are some other steps for you to take.
Firstly, WP Fastest Cache needs a tweak. Click on WP Fastest Cache in the menu and then the CDN tab. Click the CDN by Coudflare button.
Now go to your Cloudflare account, click on your profile in the top right of the screen and in the dropdown, click My Profile. On the next screen, click the API Tokens tab and then the View button for the Global API Key. You may have to re-enter your password at this point. When the API key is displayed, copy it to your pasteboard.
Back in WordPress, paste the API key into the popup and also enter the email address you registered with Cloudflare. Click the Next button.
You’ll run through a few more popup screens. The first should confirm that Cloudflare’s minification settings are turned off. You set WP Fastest Cache or Asset Cleanup to minify your HTML and CSS so it isn’t required for Cloudflare to do this.
You should see the Rocket Loader is also turned off and finally that the Browser Cache Expiration has been set. Click the Finish button at the last popup screen and now WP Fastest Cache and Cloudflare should work fine together.
You may need to tweak Wordfence too if you’ve got it installed. In most cases Wordfence will just work with Cloudflare. If that’s the case for you, then ignore this.
If Wordfence is having issues after enabling Cloudflare or Cloudflare have instructed you to change Wordfence’s setting for getting IP addresses, you can follow these steps.
Under the Wordfence menu, go to All Options. On that screen, click on General Wordfence Options to open the panel and, under How does Wordfence get IPs, click the Use the Cloudflare “CF-Connecting-IP” HTTP header to get a visitor IP radio button and then click the Save Changes button.
If you ever stop using Cloudflare, you must remember to come back here and reset How does Wordfence get IPs to the Recommended setting.