I have a page view
/all-authors where both (Anonymous & Authenticated) users have access to it; However, authenticated users can follow (flag) an author and Anonymous users cannot do that.
What I am facing:
- An anonymous user visit
/all-authorspage as anonymous user.
- User wants to follow authors so:
- User Create a new account/Log in to the site.
- User Visit again
- User will be automatically logged out and the anonymous look of
/all-authorsview page will be shown to the user, also the entire site will look like the user is logged out:
Loginlink will be visible.
Create new AccountLink will be visible.
- Any block for anonymous user will also be visible.
However, if the user will click on Login link (
/user/login), the user will be automatically logged in back to the site.
Also if the user click on Create new Account (
/user/register), the user will be a prompted with
Access Denied page.
So logically speaking, the user is not technically logged out but the user is served with anonymous pages while logged in (Correct me if I am wrong).
I believe that the main problem is due of caching, so below is my caching configurations:
- Site settings is set to
Internal Dynamic Page Cachemodule which "Caches pages for any anonymous users "is uninstalled from the site.
/all-authorsview page setting for caching is set to:
- Site is connected through Cloudflare Firewall with Caching Level set to
I have tried the below:
- Clear all Caches from the site side, but the problem persist.
- Purge all caches from cloudflare side, but the problem also persist.
- Purge all caches from cPanel side (cPanel -> Cache Manager), then the problem gone and the site work as expected only for current user but after that if another user on another device logged in and visit
/all-authorsview page, she will be faced with same problem again until the caches from cPanel side is purged again
Is there anything I can do from Drupal side to fix this problem ? or it is generated from server side ?
Note: I have disabled Cloudflare cashing by turning on the Development Mode feature which will temporary bypass all caches allowing to see changes to your origin server in realtime... However, the problem remain the same with no changes !
Note 2: Support team for my VPS server replied with below information:
My senior tech tried manipulating the cache to work without the bypass URLs but they weren't able to find a fix. It seems the cache manager is interacting with your page in a way that's causing the session to be killed. The bypass URL is the fix that would work here, but as you mentioned that will hurt your performance. Outside of that, we're not entirely sure what would be causing your site to respond that way with the caching settings. Perhaps adjusting the sessions lifetime could yield results.