views – Logged in users are automatically logged out when visiting some specific pages

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), she will be automatically logged in back to the site.

Also if the user click on Create new Account (/user/register), she will be a prompted with Access Denied page.

So logically speaking, the user is not technically logged out but she 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 ?