Session logged out when user opens certain portal pages

I built a custom app with portal pages. Some of these pages are built using ‘Web Page’ and others by creating files in ‘www’ folder. User is getting logged out when they navigate to pages that are built in ‘www’ folder. Interestingly, the page is getting rendered i.e., all the data that needs permissions is being fetched without any problem. But once the page is rendered, user is getting logged out. (I got to know about session by looking at cookies and profile pic on right top corner is turning to ‘Login’ option)

This behavior isn’t consistent. Which is making it further hard to debug. It occurred more often in FireFox browser.

Also, users were getting logged out when they navigate to route that doesn’t exist. Any clue what could be the cause? Or, where I have to check for these scripts that are logging out the user?

On further debugging I came to know that a request for website_script.js file is setting “Guest” cookies. There by, logging out the user. Though the issue is still not solved, I hope this could help with debugging. Solving this issue or any info on cookies is appreciated :slight_smile:

Moved all portal pages to ‘Web Pages’. Yet the issues exists.

I am also facing the same issue, but in my case it is in pure Erpnext production web pages, without any custom app.
System user can login without any issues in desk pages but when they open website pages immediately session logs out.
And website users logout automatically after login.
Sometime it works perfectly in some mobile browser and some desktop Firfox browsers.
Can anyone help me out please…