CloudFlare caching logged-in links in WordPress

Hi there!

I have a WordPress blog with W3 Total Cache plugin with the extension Cloudflare installed. I have a Pro plan in Cloudflare and also have the Cloudflare plugin installed.

Frequently, when I update a page or post and purge cache, the new version of the page cached by Cloudflare contains the admin bar and links, which would be visible only to logged in users (ie: WordPress administrators). This behavior is giving me headaches, because it is not possible to forecast which pages will be cached this way.

Also, the admin links of WordPress are appearing in Google Search Console as 404 links (which is expected, since a regular visitor cannot access a link to edit a page or post).

I have some page rules in place, but I am not sure if they are related to the problem. My guess is that, when I purge the cache, Cloudflare gets a logged version of the page (because I, as WordPress admin, visit the page with the administrator links just after update the page and purge cache).

Does anyone is facing similar issue? Could you guys please provide some insights on that matter?

Thank you!

Hi,

Cloudflare does not cache HTML by default. Which product or feature are you enabling that is caching your pages?

A Page Rule with Cache Level: Cache Everything? APO for WordPress? A Cache Rule?

1 Like

Hi,

Thanks for your response.

I have a Page Rule in place like: “domain.com/*” with the rule “Cache Level: Cache Everything”.

I also have APO for WordPress in place.

I have no Cache Rule in place.

Any suggestion?

1 Like

Remove the Page Rule, as it is not needed here. APO does a much better job and is configured by default to not cache visits by logged-in users, which is the reason you’re seeing some admin stuff becoming visible to all.

1 Like

Good to know, thank you!

I have just disabled the Page Rule and purged all cache (W3 plugin and Cloudflare).

I hope this solves the problem. Thanks again. :slightly_smiling_face:

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.