Page Rules for Caching pages not effective

Hi,

I manage a Wordpress site like mysite dot com where a “discussion” folder includes a forum.

So, on the pages mysite.com/discussion and all its children pages , no cache must be applied, for any user (logged in and logged out). These pages must remain fully dynamic.

The page “/discussion” page is also the homepage of the website (This link is managed in the Wordpress settings). So “mysite dot com” and “mysite dot com /discussion” display the same elements.

In order to have no cache on all these pages (home and those of the forum), I deactivated my WP cache plugin (at least for my tests), and on CloudFlare, I’ve created Page rules with “Cache Level = Bypass” ; or “Always Online = Activated” on these different pages :
mysite dot com
mysite dot com/discussion/*

(I followed /articles/218411427#edit-a-page-rule )

As other Not dynamic parts like “mysite dot com/part1” also exist, I cannot put simply mysite dot com/*

Unfortunately, impossible to keep in cache any of these pages, all is cached. It is precisely annoying for logged in users seeing element as logged out users.

Would you see something important I might miss, in the CloudFlare settings, or in the Page Rule ?

Could it be a too long propagation time in cause ? What could be my alternatives ?

Thanks in advance for you help,

Regards,
CNDLR

Hi,

When it comes to page rules, order matters. You need to place the most specific exceptions at the top, the most generic directives at the bottom.

PR 1:
example.com/discusstion*
Setting: (any really, as this will prevent any caching setting from PRs below from applying)

PR 2:
example.com (without *, as this is only for the home page)
Settings: idem

PR 3:
example.com/* applies to remaining files and folders
Cache Level: Cache Everything
etc

If you already have the rules in that order, and it’s still caching, please remember to purge everything.

1 Like

By default, Cloudflare does not cache the HTML of a page. Unless you’ve added a Cache Everything page rule, none of those pages should be cached, and no user should see someone else’s view.

Since you didn’t post the domain name, we can’t check, but I expect that your HTML Cloudflare response headers would show “DYNAMIC” for the page content.

2 Likes

@floripare @sdayman
Hi,
Thanks for you help.
I’ve tried by starting only with :
PR 1:
example.com/discussion*
=> but that does not exclude this part from the cache.

A cache seems to be still working and the only one active cache can only be Cloudflare. So something blocks the action of the Page Rule.

My only solution for the moment is to use HTTP Headers with cache-control. Thus, nothing is cached.
But I use a Wordpress plugin that makes the whole site uncached : I cannot identify the few pages that I want to uncache. So it’s not a good solution.

Would you see what can be wrong ? Does a Page Rule works instantly, or is there a delay of propagation ?

@sdayman In Cloudflare > Cache Performance overview, the HTML part is 100% dynamic yes.

Regards

Try Edge TTL: 30 minutes. Be careful that it might cache logged in content, if you have business plan then only you should try with bypass cache over cookie to ensure logged in content doesn’t go public. Follow at own risk.

Sorry, no TTL is possible in my case.

I try now a simple :
/*
in order to uncache my whole website.
It doesn’t work, the visited pages remained cached when I come back on them. How to make them never cached…

What other Cloudflare settings could break this PR setting ?

Thanks for any of your idea…

Sorry but your requirements cannot be fulfilled. You cannot easily cache HTML stuffs, better would be relying on Static Caching only. I am afraid I can’t over simplify this thing.

No problem
Finally I’ll do differently.

thanks