Serve cache to logged-in users with APO

I’m testing the switch from “Cache Everything” rules to APO for the first time, and noticed that APO automatically bypasses cache for users that are logged-in to WordPress.

Of course that’s perfect for when you’re browsing and working in WordPress’ Admin pages (I had a Page Rule to exclude those from Cache Everything before), but I still want all our public pages/posts to be served from cache, even for logged-in users. How do I do that, please?

I think that’s important because, while we’re working on posts, we can be sure that the public page is correctly updated from Cloudflare’s cache and that we’re seeing the same thing that all our visitors will see. Also, loading from CF cache is much faster anyway. :wink:

Thanks!

It would be dangerous to do that since WordPress injects admin banners into the regular pages when you’re logged in, and some plugins may behave differently when logged in too. These admin tools then end up being cached in your local datacenter in the event of a cache miss, resulting in others hitting that datacenter seeing them.

I’ve not tried it to know if Cloudflare blocks it anyway but if this were possible it would be with a Cache Rule that makes everything that’s not wp-admin eligible for cache. I don’t recommend trying for the aforementioned reasons but you are welcome to try if you want.

It would be dangerous to do that since WordPress injects admin banners into the regular pages when you’re logged in, and some plugins may behave differently when logged in too. These admin tools then end up being cached in your local datacenter in the event of a cache miss, resulting in others hitting that datacenter seeing them.

Since we’ve been doing that for years (manually, using the Cache Everything rule), we made sure nobody from our team has that WordPress Admin Bar turned on for their accounts, so we’ve never had that issue. I just didn’t know about it affecting plugins as well… :thinking:

1 Like

Fair enough. And to be fair it depends on the plugin, I dont use WordPress enough to know any examples.

If it doesn’t work with Cache Everything then I suspect it won’t work at all. I recall there being certain cookies that always bypass cache but I can’t find the doc link at the moment…

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