Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Ideal Cloudflare Page Rules for WordPress Websites Please?

Which Page Rules to set for Wordpress blog?

         

1Lit

4:09 pm on Nov 21, 2020 (gmt 0)

10+ Year Member



I’ve spent many hours looking for the ideal Cloudflare Page Rules to set for regular WordPress websites, but there doesn’t seem to be any clear guidance.

After reading various places, we’ve created the following Cloudflare Page Rules:

[ibb.co...]

What would be the optimal Page Rules to set-up for a standard (non e-commerce/shopping cart style) WordPress blog please?

Also, for a non-Wordpress straight HTML website?

We are on the free package of Cloudflare.

Thanks a million. I’m grateful for your assistance.

robzilla

5:23 pm on Nov 21, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Are you using the Cloudflare WordPress plug-in to invalidate the cache when content is updated?

I wonder what will happen it the cache is purged and you're the first to load a page, e.g. the homepage, while you're logged in to WordPress. Normally, you'd see the WordPress admin bar throughout the site, at the top of the screen. If Cloudflare caches that result, all your visitors will also see the admin bar (but won't be able to use it). Or the other way around: if the first visitor to a page is not logged in, you won't see the admin bar on that page even when you're logged in. That's how it usually works with page caching anyway, where you would prevent this by, for example, employing a cookie-based bypass (if user is logged in, skip cache), but I don't think that's available in the free plan.

NickMNS

5:38 pm on Nov 21, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



@Robzilla
I wonder what will happen it the cache is purged and you're the first to load a page

You would need to ensure that you are in "dev-mode" each time you log in, then to be safe, and to show any changes made, you would need to purge pages you touched, or purge all if you are lazy and there are many pages.

Very simply you need to ensure that you purge the cache after your work, not before.

1Lit

9:27 pm on Nov 21, 2020 (gmt 0)

10+ Year Member



Thanks very much for the follow-ups.

> Are you using the Cloudflare WordPress plug-in to invalidate the cache when content is updated?

No, not as far as I know.

I've set the Cloudflare plug-in to activate the Cloudflare cache everywhere (apart from the Wordpress backend edit section of course).

> You would need to ensure that you are in "dev-mode" each time you log in

I've set Page Rules in Cloudflare to not have the cache kick-in in the /wp-login and /wp-admin folders (see screenshot above). So, hopefully I should be able to login.

Does anybody have any suggestions on the specific Page Rules I should use in Cloudflare's settings please?

robzilla

5:51 pm on Nov 22, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



So you do have the Cloudflare WordPress plug-in? If not, how are you going to clear the cache when you make changes to the site?

To avoid the scenario where your visitors could end up seeing the admin bar even though they're not logged in, you'd need a page rule that checks for a cookie (not available on a free plan) or one that excludes the IP addresses of everyone who logs into WordPress (not ideal, and not sure if that rule is even available). Or the Cloudflare WordPress plug-in would have to include a setting that blocks caching (e.g. by setting an HTTP header) for anyone logged into WordPress, but I don't know if it does.

You could set up a Page Rule for a specific URL, preferably one not accessible from the website, and see how the caching works there, before you deploy it for the whole site.