How to Use Cloudflare Full-Page Caching With WordPress (for Free!)

Are you interested in an effective way to speed up the total loading time of your website? By using Cloudflare’s full-page caching for WordPress, the entire WordPress site can be served from Cloudflare’s extensive global network, resulting in impressive total load times of stability (and speed).

However, if you want to prevent your WordPress site from being hijacked, you must properly configure the full-page caching that is the subject of this message.

I’m going to show you two ways to enable safe full-page caching on Cloudflare:

  1. Use Cloudflare’s new automated platform optimization service, which costs $5 a month.
  2. Using a 100% free WordPress plugin with a free Cloudflare plan. This adds a little complexity, but avoids the $5 a month.

Are you ready to get started? Well, let’s see…

Why use Cloudflare Full Page Caching in WordPress?

Simply put: By using Cloudflare’s full page caching, your website will load very quickly, no matter where your visitors are.

View this chart using Wordfence’s Fast or Slow tool, tested from 18 different locations around the world:

You can see that, with a few exceptions (e.g. Bahrain), loading times are fairly constant at around 500 ms, whether in the US, Hong Kong, Australia, Brazil, France or elsewhere.

This is a significant advantage of fully caching your website with Cloudflare.

Note that this diagram comes from the actual test site I use for this tutorial.

Problem with Cloudflare and WordPress Caching Full page

As a result, Cloudflare includes Cache Everything in a free plan, which could fool you into thinking you can simply set up your WordPress site with Cloudflare, activate Cache Everything and leave it at that.

Sure you can, and it will ensure that Cloudflare your entire WordPress site at …… into the cache.

However, this leads to all kinds of problems because Cloudflare will not be able to detect the sessions of registered users, exclude critical sites, and so on.

In principle, your website will break down.

Say you are logged into your WordPress administration account and you are viewing a blog post with comments. Overcast then sucks this page into its cache.

When an anonymous visitor visits this page, he always seems to be logged in as administrator (even though he doesn’t actually have access to the administrator panel).

Or if you have a WordPress member site with restricted content, your registered users will not be able to see the restricted content because they will get a cached version that anonymous visitors can see.

Honestly, I’m not enough of a developer to know exactly what’s going on. I just know it doesn’t work because it has something to do with cookies and user sessions and stuff.

If you want to solve this problem, your only option is to pay the expensive Cloudflare business plan of $200 per month. You have two choices now:

  1. Use Cloudflare’s new automated platform optimization service, which is much cheaper for $5 a month.
  2. Use the free plugin from the tutorial below, which is 100% free.

Read on and I’ll show you how to…. how to set…

But first – Add your site to Cloudflare

Before you can use one of these methods, you must first add your website to Cloudflare. To do this, you need to add your website via the Cloudflare interface and customize your nameservers to refer to the nameservers provided by Cloudflare.

If you don’t know how to do this, check out our full guide to setting up Cloudflare for WordPress.

Method 1. Using Cloudflare’s Automatic Platform Optimization

When I started writing this tutorial, your only option was to use a free plugin, which I will discuss in detail in the second method. Then, in the middle of my first design, Cloudflare decided to announce a new automated platform optimization service that solves the problem for $5 per month, a much lower price (compared to the previous method that required a business plan of $200 per month). Or it’s included free with any paid Cloudflare plan.

If you’re willing to pay $5 a month, this is a great way to start, because it’s very easy to set up.

Once you have added your website to Cloudflare, install and activate the free Cloudflare Companion plugin on your website. You need to enter the email address of your Cloudflare account and your API key/token, which you can find on this page. Use a WordPress template when creating your API key, or you can just use your global API key.

Then look up and activate the button for automatic platform optimisation in the plugin settings. If you have a free plan, you will see a purchase moment before you activate it:

That’s it! It’s not free, but it’s very simple.

Method 2: How to set up free full-page caching in WordPress?

To use Cloudflare’s Cache All rule on WordPress without breaking your site and stay on the free Cloudflare plan, you can use the free WP Cloudflare Super Page Cache plugin.

The plugin works by using HTTP response headers to control caching behaviour at Cloudflare. Even under Cloudflare’s free plan, Cloudflare will respect headlines.

I wrote a message for WP Rocket about cache-controlled HTTP headers if you want to know what it all means. But all you really need to know is that this plugin cache allows you to use everything on a free Cloudflare plan without disrupting your WordPress site. It is even compatible with e-commerce stores based on WooCommerce or Easy Digital Downloads.

To start, install and activate the plugin. Then put it on like this.

1. Create a Cloud Blowout Token

To connect to your website, WP Cloudflare Super Page Cache offers two options :

  1. You can use your Cloudflare global API key. This is the easiest option, but personally I don’t want to circulate a global key because I have a lot of websites in my Cloudflare account.
  2. You can create a special API token for this page. Although it requires a few extra steps, I recommend this method because it is the safest.

To create a special Cloudflare token, go to this page and click Create token:

On the next screen, click the Getting Started button next to Creating a Custom Token:

You must now enter a name and configure it as follows:

Allow me:

  • Account – Account settings – Read
  • Account – Working scenarios – Editing
  • Area – Cache Cleaning
  • Area – Page rules – Editing
  • Zone – Zone Settings – Change
  • Zone – Edit
  • Zone – Work Roads – Edit

Account Resources :

Choose your Cloudflare account

Commodity area :

Select your WordPress site.

Then click on Next:

On the overview page, click Create token. Now, you should see your badge. Keep it handy, because you’ll need it in the next step.

2. Add an API token to plug inparameters

Then go to the settings page → WP Cloudflare Super Page Cache in your WordPress control panel and configure everything as shown below:

  • Authentication mode – API token
  • Cloudflare API token – paste the API token you generated in the previous step.
  • Cloudflare domain name – The domain name of your website is exactly as it appears in your Cloudflare account.

Then click the Update Settings button:

3. Enabling page caching

Once you have added your API key, you should see a prompt at the top of the page to enable page caching. Press this button and you should be set to Jet :

To check that everything is working, click the Test Cache button:

You can also use this section to quickly clear the cache of your website.

4. Configuring page caching behavior (optional)

The plugin should work with the default settings. However, you have many possibilities to adjust things if you wish. In some situations it may also be necessary to achieve the desired behavior.

For example, by default the plugin adds a query parameter at the end of the URL for registered users that looks like this:

This query parameter serves as a cache booster for registered visitors. However, if you do not like the display, you can enable the control mode in the cache settings of the plugin:

There are many other well-documented frameworks, and I suggest you explore them all.

That’s it! Your website now benefits from free full-page caching on Cloudflare.

Getting Started Today with Cloudflare Full Page Caching for WordPress

Personally, I don’t like to use the Cloudflare CDN for partial content, but it’s a completely different ball game when using full-page caching with Cloudflare.

However, the disadvantage of standard caching of an entire page is that it can affect the dynamic parts of your WordPress site.

The methods of this switch allow you to benefit from fast total loading times while serving dynamic content.

If you’re willing to pay for it, the easiest way to use Cloudflare’s automatic platform optimization service for WordPress is for $5 a month.

Or, if you’re more of a do-it-yourselfer, you can configure it for free with the WP Cloudflare Super Page Cache plugin.

Do you have any questions about using Cloudflare’s full-page caching on WordPress? Ask in the comments!

Related Tags:

cloudflare cache everything wordpress,wp speed matters cloudflare,best cloudflare settings,cloudflare speed up wordpress,cloudflare wordpress html caching,cloudflare bypass cache on cookie missing,cache everything cloudflare,wordpress cloudflare page rules,cloudflare cache speed,cloudflare cache warming,cloudflare cdn best practices,tcp turbo cloudflare,kinsta cloudflare,how to create page rule in cloudflare,godaddy cloudflare cdn,free cdn wordpress,how to setup cloudflare free cdn in wordpress,cloudflare woocommerce page rules,speed up wordpress cloudflare,cloudflare setting 2019,cloudflare wordpress apo,siteground railgun,configuring cloudflare,cloudflare full page caching siteground,wordpress cloudflare cache everything,cloudflare browser cache ttl,bypass cache on cookie cloudflare,cloudflare wordpress plugin,cloudflare page rules,cloudflare caching woocommerce