Skip to content

Cloudflare HTML Caching for WordPress: Our Rule, the Exclusions (wp-cron, WooCommerce) and How to Verify DYNAMIC

On this page

Last updated: · By

In short: Cloudflare does not cache HTML by default, so every visit to a WordPress site reaches the server. One rule in Cache Rules fixes that, but it is only safe with exclusions: logged-in users, the admin area, /wp-cron.php and the three WooCommerce cookies. On 7 Nov 2026 I found two missing exclusions on my own site, fixed them and confirmed that cron and the cart return DYNAMIC. A cached page answered in 63 to 297 milliseconds, against 1,035 without cache.

⏱ Time to complete: 15 minutes · Difficulty: Intermediate · Last checked against the Cloudflare dashboard: 7 Nov 2026

The short version in numbers (measured on my own site, November 2026):

  • Without HTML cache (6 Nov 2026): median TTFB of 1,035 milliseconds.
  • With the rule, from cache (6 Nov 2026): 297 milliseconds, through the Cloudflare edge server in Marseille.
  • Same page on 7 Nov 2026: 63 milliseconds, through the edge server in Tel Aviv.
  • My rule settings: Edge TTL of two hours, Browser TTL of 10 minutes, no storing of responses with status 400 and above.
  • Plan: Cloudflare Free. Cache Rules are available on it at no cost.
  • Exclusions I added on 7 Nov 2026: /wp-cron.php and the cookies woocommerce_items_in_cart, wp_woocommerce_session_ and woocommerce_cart_hash. After the fix they all return DYNAMIC.

Why doesn’t Cloudflare cache WordPress pages?

Because, according to the Cloudflare documentation, by default it caches only files by extension: images, CSS, JavaScript, fonts. HTML and JSON are not cached. The result: images arrive from a nearby server, but the page itself is built on your server every time.

You can see this in the cf-cache-status header. A WordPress page on default settings will usually return DYNAMIC, meaning Cloudflare did not try to store it. After the rule, the same page returns MISS the first time and HIT after that. The full list of values: Cloudflare cache responses.

What can go wrong with HTML caching?

The real risk is caching a personal page and serving it to everyone. If the page of a logged-in admin, with the admin bar, gets into the cache, every visitor will see it. The same goes for a full cart or a “My account” page in WooCommerce. That is why the rule is built entirely from exclusions: what does not go into the cache.

What to excludeHow to detect itWhy
Logged-in usersA cookie containing wordpress_logged_inSo that a page with the admin bar is never stored
The admin areaA path starting with /wp-adminA fully personal area
LoginA path containing /wp-loginForms and one-time security tokens
Password-protected pagesThe wp-postpass cookieContent protected by a password
CommentersThe comment_author cookieName and email prefilled in the form
The REST APIA path containing /wp-jsonDynamic data for plugins and the editor
PreviewA query string with previewDrafts
WooCommerce (if you have a store)The cookies woocommerce_items_in_cart, wp_woocommerce_session_, woocommerce_cart_hash, and the cart, checkout and account pathsPersonal cart, prices and shipping
WP-CronThe path /wp-cron.phpThe file that runs scheduled tasks. From cache it never runs at all

I tested this myself: until 7 Nov 2026 my rule did not exclude WooCommerce or /wp-cron.php, because the site has no store. A request with the woocommerce_items_in_cart cookie got HIT, meaning a page from the cache. On a site with a store that is a real fault, so I added the exclusions on my site too. The details are in the section what I found and fixed. What it looks like when this breaks in a store: a cart that empties or a price that does not update in WooCommerce.

How do you create an HTML cache rule in Cloudflare?

The domain has to be connected to Cloudflare with the orange cloud (Proxied). If that is not done yet: connecting a Cloudflare domain to Cloudways, and the basic CDN settings in the Cloudflare CDN setup guide.

  1. In the Cloudflare dashboard, select the domain, then Caching > Cache Rules > Create rule.
  2. Give the rule a clear name, for example WordPress HTML cache.
  3. Choose Custom filter expression, click Edit expression and paste an expression like the generic example below (replace the domain).
  4. Under Cache eligibility choose Eligible for cache.
  5. Under Edge TTL choose Ignore cache-control header and use this TTL and set a duration. I chose two hours. Add a Status code TTL row: from 400 and above, No store.
  6. Under Browser TTL choose Override origin and a short duration. I use 10 minutes, because purging the cache in Cloudflare does not clear visitors’ browsers.
  7. Click Save and test with curl, as in the next section.

This is the full expression, with every exclusion I tested. My own rule is built on the same logic. Replace the domain and paste it into Edit expression:

(http.host eq "example.com"
 and not starts_with(http.request.uri.path, "/wp-admin")
 and not http.request.uri.path contains "/wp-login"
 and not http.request.uri.path eq "/wp-cron.php"
 and not http.request.uri.path contains "/wp-json"
 and not http.request.uri.query contains "preview"
 and not http.cookie contains "wordpress_logged_in"
 and not http.cookie contains "wp-postpass"
 and not http.cookie contains "comment_author"
 and not http.cookie contains "woocommerce_items_in_cart"
 and not http.cookie contains "wp_woocommerce_session_"
 and not http.cookie contains "woocommerce_cart_hash")

On a WooCommerce store, also add an exclusion for the cart, checkout and account paths, for example and not http.request.uri.path contains "/cart". Adjust the paths to the page names on your site, since on a store with localized slugs they are not always in English. The settings themselves are documented in Cache Rules settings, and the WooCommerce cookie names are listed in the official WooCommerce cookie list.

How do you check that the cache really works?

Run curl on the same page a few times and look at the cf-cache-status header and the time to first byte. The first request will be a MISS, and from the second on a HIT:

curl -s -o /dev/null -D - -w "ttfb=%{time_starttransfer}\n" https://example.com/ | grep -i -E "cf-cache-status|ttfb|cf-ray"

A second test, just as important: add a fake login cookie with -H "Cookie: wordpress_logged_in_x=1". The response should be DYNAMIC. If you get HIT, the exclusion is not working, and logged-in users may receive other people’s pages.

Which exclusions were missing on my site, and how did I confirm DYNAMIC?

Two: /wp-cron.php and the WooCommerce cookies. I found them on 7 Nov 2026 in a routine curl check, fixed them the same day and measured again. This is the full table, measured on 7 Nov 2026 from a home connection in Israel, 3 requests per row:

RequestBefore the fixAfter the fixWhat it means
/wp-cron.phpHIT, max-age=600DYNAMIC, no-cache, max-age=0The file reaches the server every time
Cookie woocommerce_items_in_cartHITDYNAMIC (3 out of 3)A cart will not be served from cache
Cookie wp_woocommerce_session_Not testedDYNAMIC (3 out of 3)Same
Cookie woocommerce_cart_hashNot testedDYNAMIC (3 out of 3)Same
Cookie wordpress_logged_inDYNAMICDYNAMIC (3 out of 3)The old exclusion still works
Anonymous visitor, no cookiesHITMISS and then HITThe cache is not harmed by the fix

Why is wp-cron from cache a problem? WP-Cron is the mechanism that runs scheduled tasks in WordPress: publishing posts, plugin backups, cleanup. When the file is served from cache, the request never reaches the server and the tasks do not run. On my site it did no harm, because WP-Cron is off and a scheduled task on the server runs it. On a site that relies on the regular WP-Cron, this is exactly how you end up with posts that do not publish on time. The symptom and its fix: Missed Schedule in WordPress, and server-side tasks: Cron Jobs on Cloudways.

These are the commands I ran. Run each one 3 times, because the first request is always a MISS or DYNAMIC:

curl -s -o /dev/null -D - https://example.com/wp-cron.php | grep -i -E "cf-cache-status|cache-control"
curl -s -o /dev/null -D - -H "Cookie: woocommerce_items_in_cart=1" https://example.com/ | grep -i cf-cache-status
curl -s -o /dev/null -D - -H "Cookie: wp_woocommerce_session_test=1" https://example.com/ | grep -i cf-cache-status
curl -s -o /dev/null -D - -H "Cookie: woocommerce_cart_hash=test" https://example.com/ | grep -i cf-cache-status
curl -s -o /dev/null -D - https://example.com/ | grep -i cf-cache-status

What the correct result looks like: the first four should always return DYNAMIC. The last one should return HIT from the second request. If it also returns DYNAMIC, the rule excludes too much, for example a cookie that is too broad, and the cache is not working for anyone.

DYNAMIC does not mean the page is slow in every case. Below Cloudflare, on the Cloudways server, there is another cache layer, Varnish, with its own exclusions. In my test some DYNAMIC requests came back fast, and some took about 0.8 to 1.3 seconds. How Varnish works: Varnish on Cloudways.

How much did it improve response time on my site?

Roughly 3.5 to 14 times faster, depending on which Cloudflare edge server the request reached. I measured from the same connection, 6–7 requests per case, and this is the median:

DateCasecf-cache-statusMedian TTFB
6 Nov 2026Homepage, cache bypassedMISS1,035 ms
6 Nov 2026Homepage from cache (edge server in Marseille)HIT297 ms
7 Nov 2026Homepage, cache bypassedMISS890 ms
7 Nov 2026Homepage from cache (edge server in Tel Aviv)HIT63 ms
7 Nov 2026Guide, with a login cookieDYNAMIC720 ms

Two conclusions: first, the cache saves the page build time on my server in Frankfurt, roughly half a second to a second. Second, I do not choose the edge server. On 6 Nov my requests were routed to Marseille (CF-RAY with the code MRS), and on 7 Nov to Tel Aviv (TLV). This is a measurement from a single point, so it shows a direction, not a benchmark. For an explanation of breaking TTFB into parts: high TTFB and how to diagnose it. The cache saves time even when the request goes through Marseille, so it is the first thing worth doing: why the site is served through Europe and what helps for free.

Black Friday80% off
80% off 2 months of managed hosting

The code BFCM802 takes 80% off your bill for the first two months (up to $200 off per month), including unlimited free site migrations. New customers only, and only until the offer ends.

The offer ends on December 4, 2026 at 23:59 (UTC+2).

Ends in—days—hours—minutes—seconds
Code:
Grab the 80% now

Start with a free trial, no credit card. Enter the code at checkout and check that it shows up.

After Black Friday: 30% off for 3 months with the code ASAEL. On a large server (above about $444 a month) ASAEL already saves more today. BFCM802 vs. ASAEL calculator

What happens when you update a page?

Visitors keep seeing the old version until the cache expires, unless you purge it. This is the main drawback of HTML caching on the free plan. On my site an update reaches visitors within up to two hours, or immediately after a manual purge in Caching > Configuration > Purge Cache.

  • A shorter Edge TTL (for example 30 minutes) reduces the wait, at the cost of more requests to the server.
  • Targeted purge: in Purge Cache you can clear a single URL instead of the whole site.
  • Automatic purge: according to the Cloudways knowledge base article, the Breeze plugin purges the Cloudflare cache automatically when posts and pages are updated, when you use the Cloudways Cloudflare Enterprise add-on. The guide: Breeze on Cloudways.

When is the Cloudways Cloudflare Enterprise add-on the better choice?

When you do not want to manage rules and purge the cache by hand. The Cloudways add-on costs from $4.99 per month, with a 30-day trial (according to the product page, as of 6 Nov 2026), and it integrates with Breeze. For a small content site that is updated once a day, the free rule is enough. For a store, or a site updated every hour, the time and mistakes you save are worth the price.

The full comparison between the plans: Cloudflare Free vs Enterprise. The prices of all add-ons: Cloudways add-on pricing.

What are the common mistakes with HTML caching?

Testing while logged in: a logged-in user bypasses the cache and will always see DYNAMIC. Test in a private browsing window or with curl.

Ignoring query strings: every URL with a different parameter, for example ?utm_source=, is stored separately and starts as a MISS. In my test, the same URL with a random parameter returned MISS the first time and HIT from the second.

Forgetting the store: I saw on my own site that without an exclusion, a WooCommerce cart cookie gets a page from the cache. Exclude all three cookies, not just one.

Forgetting wp-cron: a rule that catches “everything that is not excluded” also catches /wp-cron.php. Exclude it, and check that it returns DYNAMIC.

Caching errors: without a Status code TTL row, a temporary server error page can be stored and served for two hours.

Frequently asked questions

Does the free Cloudflare plan cache HTML pages?

Not by default. Cloudflare caches by file extension, and HTML is not included. You need a Cache Rules rule that marks the pages as Eligible for cache, and that is available on the free plan too.

What does cf-cache-status DYNAMIC mean?

It means Cloudflare did not try to store the response, usually because it does not meet the default rules or because a rule excluded it. On a WordPress page without an HTML cache rule this is the normal value. A logged-in user should get DYNAMIC even after the rule.

Which cookies should you exclude in a WordPress HTML cache?

At least wordpress_logged_in, wp-postpass and comment_author. On a WooCommerce store, add the three cookies woocommerce_items_in_cart, wp_woocommerce_session_ and woocommerce_cart_hash, and also the cart, checkout and account paths.

Do you need to exclude wp-cron.php from the Cloudflare cache?

Yes. Without an exclusion, Cloudflare may serve the file from cache, and then WordPress scheduled tasks do not run. On my site it was served from cache with max-age=600 until I excluded it on 7 Nov 2026, and since then it returns DYNAMIC.

How do you check that a Cloudflare exclusion works?

Send a curl request with the cookie, or to the excluded path, and check the cf-cache-status header. The response should be DYNAMIC on every attempt. At the same time, check that a regular request without cookies returns HIT, otherwise the rule excludes too much.

What should you set the Edge TTL to?

On my site it is two hours, for a content site that is updated a few times a day. A longer TTL saves requests to the server, but updates appear later if you do not purge the cache. For a site that updates constantly, 15–30 minutes is a reasonable starting point.

Does Cloudflare HTML caching replace Varnish or Breeze?

No, it adds a layer. Varnish stores pages on the server itself, and Cloudflare stores them close to the visitor. When the Cloudflare cache expires, Varnish still saves the server from building the page.

How do you purge the Cloudflare cache after an update?

In the dashboard, under Caching and then Configuration, there is Purge Cache: you can clear a single URL or everything. With the Cloudways Cloudflare Enterprise add-on, Breeze purges automatically when you update posts and pages.

Why does TTFB from cache differ from day to day?

Because Cloudflare routes each request to an edge server of its own choosing. On my site, a request that went through Marseille came back in 297 milliseconds, and one through Tel Aviv in 63. To see where you landed, check the code at the end of the CF-RAY header.

Sources: my own measurements from 6 Nov 2026 and 7 Nov 2026, including the exclusion test after the fix (curl from my connection and the Cloudflare dashboard for cw-servers.com); Default cache behavior, Cloudflare cache responses, Cache Rules settings (Cloudflare Docs); WooCommerce cookies (WooCommerce Docs); Cloudflare Enterprise on Cloudways; How to Use Breeze Cloudflare Integration for Cache Purging (Cloudways Knowledge Base). Written and checked by Asael Dreyer · Updated: 7 Nov 2026

Disclosure: this is an independent site, not the official Cloudways site. Some links on this site are affiliate links: if you sign up through them we earn a commission, at no extra cost to you. Full details

Picture of Asael Dreyer
Asael Dreyer

Hi, I'm Asael Dreyer, CEO of an SEO agency that runs hundreds of websites hosted on dozens of Cloudways servers.
Everything you will find here comes from hands-on experience, mine and my teams', straight from the field: from the guides to the recommendations. All to help you get the most out of Cloudways.

More about me →

Need help? Got a question about your server or this guide? Write to us and we will get back to you.

More guides on this topic:
מפריד
Thanks for your message!
We will get back to you soon.
Ready to get started?

Sign up with the coupon code ASAEL