Hello, My website (Wordpress) has Member Area. People must log in to see the member-only content. But, when a user logs in, the website still shows as an anonymous user (not show the member-only content). Sometimes some pages show the member-only content since the user has not logged in.
So How can I disable cache for logged in users? (and Still use cache for only anonymous users)
Now I use page rules like this:
*mywebsite.com/wp-admin
Security level: High
Cache Level: Bypass
mywebsite.com/
Browser Cache TTL: 30 minutes
Cache Level: Cache Everything
Edge Cache TTL: a day
The page rule for wp-admin should end with a wild card: *example.com/wp-admin*
If you make use of wp-json, you must also include a page rule for that: *example.com/wp-json*
Cache Leve: Bypass
etc
Also, only one Page Rule triggers for any URL. So you need to make sure the above rules are the first (or at least that they come before the rule to cache everything)
Last, make sure your WP caching plugin is set not to cache pages for logged in users.
That Page Rule for Cache Everything is the problem. I can see you tried to type *mywebsite.com/*, but the asterisks made it all italics.
So now your pages are cached based upon who visits it first. If it’s a guest, it will be anonymous. If it’s a logged in user, subsequent guests will see that person’s cached page.
To disable caching for logged in users, you need either
A business plan that lets you Bypass Cache on Cookie -or-
This cool setup that uses Workers to bypass cache for logged in users: Improving HTML Time to First Byte (the good stuff is near the bottom)