Black Friday 40% off the first year of every plugin. Use code BLACKFRIDAY40

Skip to content

Cloudflare WordPress Setup: How to Configure It Step by Step

Cloudflare WordPress Setup: How to Configure It Step by Step

A Cloudflare WordPress setup takes about 20 minutes and costs nothing on the free plan. You add your domain, point your nameservers at Cloudflare, pick an SSL mode and connect the official plugin.

We installed the free Cloudflare plugin 4.14.5 on a WordPress 7.1.3 and WooCommerce 11.2 test store in October 2026. We read the current Cloudflare docs for every dashboard step and checked the response headers on our own site. We did not connect a live Cloudflare account, so the dashboard screens come from Cloudflare’s docs and are credited.

This guide covers the six setup steps first. Then it shows how Cloudflare SSL behaves, what Cloudflare caches on a WooCommerce store, and why the edge keeps serving old HTML after you deploy.

What Cloudflare Does for a WordPress Site

Cloudflare sits between your visitors and your server. Once your domain points at it, it serves static files from a nearby data center, filters bad traffic and handles your SSL certificate. A WordPress site needs no code changes for any of that.

Even the free plan proxies your traffic, which gives you caching and DDoS protection, as Cloudflare’s onboarding guide explains. Paid features such as the WordPress firewall rules sit on top of it. The plugin on WordPress.org has 200,000+ active installations as of October 2026.

Two parts of the stack are easy to confuse. The Cloudflare account holds your DNS, SSL mode and cache rules, while the WordPress plugin only talks to that account through an API token. You can run Cloudflare without the plugin, but you lose one-click purges and the recommended settings.

Cloudflare WordPress Setup in Six Steps

A Cloudflare WordPress setup needs six steps, from adding your site to connecting the plugin with an API token. Only the nameserver change happens at your registrar, while everything else happens inside Cloudflare or your WordPress admin. Plan for about 20 minutes plus the time nameservers take to spread.

Cloudflare WordPress setup in six steps

Step 1: Add Your Site to Cloudflare

Create a free Cloudflare account, open Domains and select Onboard a domain. Enter your apex domain, such as example.com, without www or https. Then choose the free plan when Cloudflare asks you to select a plan.

Cloudflare’s guide to onboarding a domain says the apex domain must sit one level below a valid top-level domain. A subdomain like shop.example.com does not qualify.

Onboard a domain step in the Cloudflare dashboard guide
Source: Cloudflare Docs

Step 2: Check Your DNS Records

Cloudflare scans your existing DNS records and imports what it finds. The scan is not complete, so compare the list with your old DNS provider. Look at the root record, www, mail records and any subdomain you use.

The Cloudflare onboarding guide warns that a missing record can show visitors a DNS_PROBE_FINISHED_NXDOMAIN error. Add anything that is missing before you go on.

Each web record has a proxy status toggle.

Orange cloud means traffic goes through Cloudflare, which gives you caching and protection. Gray cloud means DNS only.

Keep the records for your website orange. Use gray for records that verify your domain with other services, as Cloudflare advises.

Cloudflare proxied and DNS only record status
Source: Cloudflare Docs

Step 3: Change Your Nameservers

Cloudflare gives your domain two nameservers. Copy them, then paste them into the nameserver fields at your registrar in place of the current ones.

If your domain uses DNSSEC, turn it off at the registrar first. Cloudflare’s guide warns that changing nameservers with DNSSEC active can make a domain unreachable. Cloudflare’s guide covers the rest of the DNSSEC change.

Cloudflare assigns two authoritative nameservers
Source: Cloudflare Docs

Step 4: Set the SSL/TLS Mode

Set the SSL/TLS mode to Full (strict) if your server has a valid certificate. Cloudflare then encrypts both connections and checks your certificate. Flexible mode only encrypts the visitor side, which is why it can cause redirect loops on WordPress sites.

Cloudflare’s SSL/TLS mode reference says it strongly recommends Full or Full (strict) where possible. Cloudflare is also rolling out Automatic SSL/TLS, which picks the safest mode your server supports and never moves to a weaker one.

Cloudflare recommends Full or Full strict SSL modes
Source: Cloudflare Docs
Cloudflare SSL modes compared

Step 5: Install the Cloudflare Plugin

In WordPress go to Plugins, then Add New, and search for Cloudflare. Install the plugin published by Cloudflare itself. Its card showed 200,000+ active installations and was marked compatible with WordPress 7.1 on our test site.

The same card showed 3.5 stars from 181 ratings in October 2026. The plugin is useful, but it is not a polished product, so test it on a staging copy first if you can.

Cloudflare plugin in the WordPress Add Plugins screen
Screenshot from our WordPress 7.1 test site

After you activate it, Settings, then Cloudflare shows a welcome screen with a link for people who already have an account. Click the sign-in link to reach the credentials form.

Cloudflare plugin welcome screen after activation
Screenshot from our WordPress 7.1 test site

Create an API token in Cloudflare from the WordPress template, then paste it into the plugin with your email and click Save API Credentials. Next click Apply for the recommended settings. The token screen is the only part that needs your Cloudflare login.

Cloudflare’s APO setup guide tells you to open Account API tokens, select Create Token, find WordPress in the template list and choose Use template.

Cloudflare API token WordPress template step
Source: Cloudflare Docs

In WordPress the plugin asks for an email and a field named Global API Key Or API Token. Paste the token into that second field. Treat it like a password and never share it in a ticket or screenshot.

Cloudflare plugin API credentials form
Screenshot from our WordPress 7.1 test site

The last two actions on that screen are Apply for the recommended settings and the Automatic Platform Optimization toggle. Leave the toggle off unless you bought APO. We cover that choice in the APO section below.

Apply recommended Cloudflare settings for WordPress
Source: Cloudflare Docs

Cloudflare also soaks up junk traffic once your site is proxied. Our guide to WordPress DDoS protection covers what else to set up beside it.

How to Set Up Cloudflare Flexible SSL on WordPress

To set up Cloudflare Flexible SSL, open SSL/TLS in the dashboard and choose Flexible. Visitors then see HTTPS, while Cloudflare talks to your server over plain HTTP. Use it only when your server has no certificate, because every other mode is safer.

Cloudflare describes Flexible mode as encrypting only the visitor connection. The origin connection stays unencrypted, and Cloudflare recommends upgrading the origin when possible.

The trouble starts when WordPress is set to HTTPS. Your server sees plain HTTP from Cloudflare, redirects to HTTPS, and Cloudflare asks again over HTTP.

The browser then shows ERR_TOO_MANY_REDIRECTS. Our guide on the ERR_TOO_MANY_REDIRECTS error covers other causes.

The Cloudflare plugin has a fix for this. Its source treats an X-Forwarded-Proto header of https as a secure request and marks the page as HTTPS. We tested that on our test site.

  • Request from a Cloudflare address, plugin on: WordPress reported HTTPS and replaced the server address with the visitor address.
  • Same request, plugin off: WordPress reported plain HTTP, which is the setup that loops.
  • Same header from an ordinary address: WordPress ignored it, so a visitor cannot fake HTTPS by sending the header.

We simulated a request from a published Cloudflare address range for the first two checks. The plugin only trusts the header when the request really comes from Cloudflare.

That is a sensible guard, yet the real fix is Full (strict). For other certificate errors see our guide to common SSL issues in WordPress.

Cloudflare Flexible SSL header test results

How to Set Up Cloudflare Free CDN in WordPress

You set up the Cloudflare free CDN in WordPress by keeping the orange cloud on your website records. That one setting routes visitors through Cloudflare, which then caches your static files. No plugin or extra rule is needed for images, CSS and JavaScript.

Cloudflare’s cache documentation says the CDN caches by file extension and does not cache HTML or JSON by default. The default list includes JPG, PNG, WEBP, CSS, JS, PDF and WOFF2 files.

Cloudflare does not cache HTML by default
Source: Cloudflare Docs

That default is why a Cloudflare WordPress site feels faster on images but not on the first byte. Your server still builds every HTML page. The next section covers how to cache the HTML too without breaking a store.

What Cloudflare caches by default

How to Cache WordPress HTML With Cloudflare Cache Rules

Cloudflare cache WordPress settings come down to two choices: Cache Rules or APO. To cache WordPress HTML with Cache Rules, match your public pages and add bypass conditions for logins and carts. The free plan includes 10 cache rules, according to Cloudflare’s Cache Rules page.

Go to Cache Rules in the dashboard and select Create rule. Under the cache settings, pick the option that caches matching requests, or choose Bypass cache to skip them. Cloudflare notes that cache-control headers can also change the outcome.

Cloudflare cache rule options for caching or bypassing
Source: Cloudflare Docs

Page Rules are the older tool. Cloudflare now marks them as deprecated on its Page Rules page, and the free plan allows only three. Use Cache Rules for anything new.

What a store must never cache

The WooCommerce developer docs say the Cart, My Account and Checkout pages must stay dynamic. They show customer-specific data. The same page lists the cookies that mark a shopper: woocommerce_cart_hash, woocommerce_items_in_cart and wp_woocommerce_session_.

We checked what WooCommerce 11.2 sends on its own. The home page sent no Cache-Control header at all, so a Cache Everything rule would store it.

The cart and account pages sent no-cache and private. After an add to cart, even the home page switched to no-store.

WooCommerce Cache-Control headers on cart and account pages
Screenshot from our WooCommerce 11.2 test store

That result gives you the rule. Add a bypass for cart, checkout and my-account paths, and for any request that carries a WooCommerce cookie or a WordPress logged-in cookie. Test with a real cart in a private window before you trust it.

Caching is only one part of speed. Our guide to speeding up a WooCommerce website covers images, themes and plugins. When a CDN is not enough, our WordPress speed optimization services look at the rest of the page.

Is Cloudflare APO Worth $5 a Month?

APO is worth it when your pages are mostly public and your server is slow to respond. Automatic Platform Optimization caches your HTML at Cloudflare’s edge, so most visits never reach WordPress. It costs $5 a month on the free plan and is included in paid plans.

The Cloudflare plugin listing describes APO as serving the full site, including cached HTML, from Cloudflare’s network. The APO setup guide says free plan users must purchase APO before installing the plugin.

APO decides what to cache by itself, so you do not write HTML cache rules. Still test your cart with a real session, because custom plugins can set their own cookies.

It also needs care. The APO guide recommends turning off caching plugins such as WP Rocket or W3 Total Cache during setup, and the plugin does not support multisite.

Check that it works with the headers Cloudflare lists on its APO verification page. Look for cf-cache-status HIT, cf-apo-via tcache and a cf-edge-cache value that names the WordPress platform. A slow first byte is the usual reason to pay, and our guide to reducing TTFB in WordPress covers the other fixes.

Why Cloudflare Serves Stale HTML After a Deploy

Cloudflare serves stale HTML after a deploy because the edge keeps its copy until the cache lifetime ends or something purges it. A code push changes files on your server but sends no signal to Cloudflare. You need to purge after the deploy, or keep the HTML lifetime short.

We checked this on devdiggers.com, which runs behind Cloudflare. A blog post came back with cf-cache-status HIT and a cdn-cache-control header of max-age=2592000.

That is 30 days at the edge. The browser header on the same response said no-cache, so only Cloudflare holds the copy for that long.

Cloudflare explains CDN-Cache-Control as a header that controls CDN caches separately from Cache-Control. The origin’s Cache-Control passes through and does not change what Cloudflare does. Our cart page on the same site returned cf-cache-status BYPASS, as it should.

Cloudflare cache status HIT on a post and BYPASS on the cart
Response headers from devdiggers.com, October 2026

Does the plugin save you? Only partly. Its source code purges the cache when a post changes status or a comment is posted.

It also purges when you switch theme, save the Customizer, or delete a post or file. A deploy that copies theme files fires none of those hooks.

When the Cloudflare plugin purges the cache

The fix is to add a purge to your deploy script. Purge the changed URLs, or everything on a small site, as the last step.

Then request the page and confirm cf-cache-status no longer reads HIT. If you cache HTML at all, treat the purge as part of the release.

How to Purge the Cloudflare Cache

To purge the Cloudflare cache, use the dashboard, the plugin, or the API, depending on where you work. Cloudflare recommends purging by single URL. Purge Everything works on every plan, including free, but it empties your cache and slows the next visits.

Cloudflare’s purge cache page lists purge by URL, hostname, tag, prefix and Purge Everything for all plans. A successful request returns HTTP 200, which only means Cloudflare received it.

How to verify a Cloudflare cache purge
Source: Cloudflare Docs

To verify a purge, request the page again and read the cache header. Cloudflare says to confirm that CF-Cache-Status is no longer HIT. The first request after a purge usually shows MISS.

Conclusion

A Cloudflare WordPress setup is simple: add the domain, fix your DNS, change nameservers, pick Full (strict) and connect the plugin. Static files are cached from then on, and your server keeps building the HTML.

Caching the HTML is a separate decision. Use Cache Rules with cart and login bypasses, or pay for APO. Either way, purge after every deploy.

Start with the six steps, then check the headers on your own site. If cf-cache-status says HIT on a page you just changed, you know what to purge.

Frequently Asked Questions (FAQs)

Q1. How do I use Cloudflare with WordPress for free?

Create a free account, add your domain and switch your nameservers to Cloudflare. The free plan proxies your traffic, which gives you caching and DDoS protection. The plugin is optional and also free.

Q2. Do I need the Cloudflare plugin?

No, the dashboard settings work without it. The Cloudflare plugin adds one-click recommended settings, purge actions and the Flexible SSL header fix. You need it for APO.

Q3. Does Cloudflare work with WooCommerce?

Yes, if cart, checkout and account pages stay uncached. The WooCommerce docs say those pages must stay dynamic. Cloudflare does not cache HTML by default, so the risk starts when you add a cache rule or APO.

Q4. Why does my site loop after I turn on Cloudflare?

Flexible SSL is the usual cause. Cloudflare reaches your server over HTTP, your server redirects to HTTPS, and the loop repeats. Switch to Full (strict) after installing a valid certificate on your server.

Q5. Can I use Cloudflare with a caching plugin?

You can, but add them one at a time. Cloudflare recommends turning off plugins such as WP Rocket or W3 Total Cache when you first set up APO. Our list of the best WordPress caching plugins helps you pick one.

Q6. How do I know Cloudflare is working?

Request a static file and read the cf-cache-status header. HIT means Cloudflare served it from cache, and MISS means it fetched a fresh copy. DYNAMIC or BYPASS on HTML pages is normal when HTML caching is off.

Q7. Is Cloudflare APO the same as a CDN?

No. A plain CDN setup caches static files such as images, while APO also caches your HTML at the edge. It costs $5 a month on the free plan as of October 2026, according to the plugin listing.

Yash Kapoor
Yash Kapoor

Yash Kapoor is the founder and WordPress expert at DevDiggers, where he builds WordPress and WooCommerce plugins for loyalty programs, point-of-sale systems, digital wallets and affiliate management. He writes about developer tools, site performance and the technical side of running a WordPress store. He draws on years of building and maintaining production plugin codebases.

Leave a Reply

Your email address will not be published. Required fields are marked *