How to Install Cloudflare on Your WordPress Site


Cloudflare is a company that provides content delivery network (CDN), DNS, DDoS protection, and security services. They have become very well known in the web performance industry for fast DNS lookup times and have a robust network of over 100 different data centers around the globe. They are backed by some of the biggest names in the industry such as Google, Microsoft, and Qualcomm and Cloudflare’s market share is continuing to grow. Some of their clients include Nasdaq, Digital Ocean, Zendesk, and Cisco.

If you are looking for an easy way to speed up and enhance the security on your WordPress site, Cloudflare is a great solution. Most customers can even utilize their free plan, which offers unlimited CDN bandwidth. Follow the steps below on how to install Cloudflare on your WordPress site.

Note: if you use Cloudflare, you can’t use our premium DNS from Amazon Route 53. Cloudflare operates as a full proxy service, which means you have to choose one or the other. If you want to use our premium DNS, you can use an alternative CDN to speed up your site, such as KeyCDN, which isn’t a full proxy.

Install Cloudflare

This tutorial assumes you already have a Cloudflare account. If you don’t, you can visit the Cloudflare website and signup for a free account.

Step 1

Log in to the Cloudflare dashboard and click on “+ Add Site.” Input your WordPress site’s domain and click on “Begin Scan.” (You don’t need to add www or HTTP/HTTPS, the root domain is fine)

add site cloudflare
Add WordPress site to Cloudflare

It may take a minute or two and then click on “Continue Setup.”

Step 2

Cloudflare gives you two options. You can use their CDN and protection (which accelerates and protects your sites) or you can simply use their DNS. Most customers will want the former, as this is where you will benefit from everything Cloudflare has to offer. To ensure that your domains are enabled, make sure the cloud is lit up as orange. If you have additional records, such as email (MX records), these should be off Cloudflare (grey). Click on continue after you have verified everything. You can always modify these records later on.

cloudflare dns records
Verify DNS records

Step 3

On the next page, you will need to select a Cloudflare plan. We recommend starting with the free plan, which works for most users. Then click “Continue.” You can read more about the differences in Cloudflare’s plans.

free cloudflare plan
Free Cloudflare plan

Step 4

You will then need to change the nameservers on your domain to point to Cloudflare (use the ones they provide). Because Cloudflare is a full proxy service, basically how it works is you point your domain to Cloudflare, and Cloudflare then points your domain to Kinsta. There is no downtime when you switch your nameservers. Here are a couple of links to documentation with different domain registrars on how to change them.

Then click “Continue.”

cloudflare nameservers
Change to Cloudflare’s nameservers

This shouldn’t take very long, but allow up to 24 hours for this change to be processed.

Step 5

If your site wasn’t already pointed at Kinsta, or you were using Kinsta’s premium DNS, you will need to update the A record to point to Kinsta within the Cloudflare dashboard. Click into “DNS” and next to the A name record, change it to your Kinsta IPv4 address. The IPv4 address of your WordPress site can be found on in your MyKinsta dashboard under your sites “Info” tab. If you aren’t a Kinsta customer, simply make sure you update it with the IP address provided to you by your WordPress host.

cloudflare a name record
Update Cloudflare A name record

And that’s it! Your WordPress site now has Cloudflare installed.

Step 6 (Optional)

There is an additional step for WordPress users which we do recommend. It is not required, but certain things with Cloudflare might not function properly if you don’t install the official Cloudflare plugin.

cloudflare wordpress plugin
Free Cloudflare WordPress plugin

You can download it from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. It features the following:

  • Fix for WordPress comments appearing from the same IP address
  • Automatic cache purging
  • Header rewrite to prevent a redirect loop when Cloudflare’s Universal SSL is enabled
  • Ability to change settings on Cloudflare account from within the plugin itself (cache purge, security level, image optimization, etc.)
  • View analytics such as total visitors, bandwidth saved, and threats blocked
  • Support for HTTP2/Server Push

After you install the plugin you will need to input your Cloudflare email address and API key in the settings. You can grab your API key here. Copy the one that says “Global API Key.” Then click on “Save API Credentials.”

cloudflare api wordpress plugin
Cloudflare WordPress plugin API credentials

Under the “Home” tab you apply the default settings or update settings as you prefer.

cloudflare wordpress default settings
Cloudflare plugin default settings

Under the “Settings” tab you can enable image optimization if you are on a pro plan, turn on development mode, change the security level, and enable automatic HTTPS rewrites.

cloudflare wordpress speed security
Cloudflare plugin speed and security settings

Under the “Analytics” tab you can view the number of requests, bandwidth, visitors, and threats on your WordPress site.

cloudflare analytics wordpress
Cloudflare plugin analytics

Common Cloudflare Problems

A very common error that users get when trying to install Cloudflare on their WordPress site is “ERR_TOO_MANY_REDIRECTS” in Chrome or “The page isn’t redirecting properly” (Firefox).

flexible ssl error cloudflare
Common flexible SSL error with Cloudflare

This is due to having SSL setup on your web server already and then having Flexible SSL enabled with Cloudflare. If you have an SSL certificate with your web host (Kinsta) already, then you will want to switch the SSL mode to full.

Set Cloudflare crypto level to full
Set Cloudflare crypto level to full

Otherwise, you can create a page rule to fix this issue.

How to Clear Cloudflare Cache

Running into problems? There will be times when you need to clear (purge) Cloudflare cache. There are two easy ways to do this.

Option 1 – Clear Cloudflare Cache in WordPress Plugin

If you have the Cloudflare WordPress plugin installed, you can purge the cache from “Settings → Cloudflare.”

Clear Cloudflare cache in WordPress plugin
Clear Cloudflare cache in WordPress plugin

Option 2 – Clear Cloudflare Cache from Control Panel

Your other option is to clear Cloudflare cache from their control panel. To do so, click into the “Caching” tab and then on “Purge Everything.”

Clear Cloudflare cache
Clear Cloudflare cache

Once you have everything up and running smoothly, it’s better to only purge the cache of individual files. Cloudflare provides an easy way to do this.

Custom purge file cache
Custom purge file cache

Note: If you purge everything, you may temporarily degrade performance on your website as assets have to re-cache. However, sometimes this is unavoidable, especially if you aren’t sure exactly what script or asset on your site needs to be refreshed.

Additional Cloudflare Settings

Now that you know how to install Cloudflare, we recommend checking out our detailed post on the best settings for WordPress users. You can also check out how much bandwidth your WordPress site uses vs the CDN and learn about Cloudflare’s Automatic Platform Optimization (APO) tool.


Save time, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience reach with 34 data centers worldwide.
  • Optimization with our built-in Application Performance Monitoring.

All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that’s right for you.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?