Logged-out cache displayed to logged-in users
If you have a site where users log in to view content, there can be cases where the logged-out page is shown to logged-in users, or vice versa.
Please check the following:
- Are you using an additional cache layer such as Varnish, NGINX, Cloudflare Cache Everything or similar?
If it does not distinguish between logged-in and logged-out visitors this will cause issues, and it should be disabled.
- Do you have the correct browser caching rules for the HTML doc?
WP Rocket sets an expires of 0 seconds in the htaccess file. If your server doesn't specify any cache rules, or sets a longer Expires, or a
cache-control: max-ageof more than 0, this can cause problems.
See how to check the cache headers here.
Without any other cache layer involved, does the problem only occur when User Cache is enabled in WP Rocket?
If so, then please install the following helper plugin which modifies the WP Rocket htaccess rules to prevent this issue.
📥 Download (.zip): WP Rocket | Add custom htaccess rules to set no-store on HTML
Developers: You can find the code for this plugin on GitHub.
How to use the helper plugin
- Download the helper plugin zip file
- Install the helper plugin on your site - go to Plugins → Add New → Upload plugin and select the zip file.
- Activate the plugin