1

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:

  1. An anonymous user visit /all-authors page as anonymous user.
  2. User wants to follow authors so:
  3. User Create a new account/Log in to the site.
  4. User Visit again /all-authors page.
  5. User will be automatically logged out and the anonymous look of /all-authors view page will be shown to the user, also the entire site will look like the user is logged out:
    • Login link will be visible.
    • Create new Account Link 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 <no caching> at /admin/config/development/performance
  • Internal Dynamic Page Cache module which "Caches pages for any anonymous users "is uninstalled from the site.
  • The /all-authors view page setting for caching is set to: Tag based.
  • Site is connected through Cloudflare Firewall with Caching Level set to Standard.

I have tried the below:

  1. Clear all Caches from the site side, but the problem persist.
  2. Purge all caches from cloudflare side, but the problem also persist.
  3. 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-authors view 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.

  • 2
    The first thing I'd try is disabling cloudflare caching altogether. – sonfd Jun 20 at 11:47
  • 1
    Does the same happen on your local copy of the site? – leymannx Jun 20 at 12:07
  • @sonfd 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 ! – Vanessa Abi Rashed Jun 20 at 16:02
  • @leymannx I do not have currently a local copy of the site but I will clone a copy and check it out – Vanessa Abi Rashed Jun 20 at 16:03
  • As per "cPanel Cache Manager" Documentation: The cPanel uses Nginx as a powerful caching proxy in front of Apache so I tried to disable cPanel caching from server side and the site is now working as expected with no any strange behavior... But I don't think turning off the caching system on my server is the best way to go as it will affect the performance of my site !!!! – Vanessa Abi Rashed Jun 20 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.