@Tuneachi I am sharing AI Summary, it may help in your next debug/ fix
Possible Causes & Workarounds
1. Cache/Session Management Issue
From https://discuss.frappe.io/t/frappe-session-user-returns-wrong-user-account-in-portal-pages/93583:
Solution for portal pages:
python
# Add this to EVERY .py file in www/ folder
no_cache = 1
Then run:
bash
bench clear-cache
2. Redis Session Cache Problem
Common patterns:
-
First user logs in → works fine
-
Second user logs in → gets first user’s session
-
Random switching during active sessions
-
Activity log shows:
"Logged into another session"
3. Possible Triggers
-
Proxy/VPN configurations
-
Load balancers (AWS, Azure)
-
Production mode (works fine in dev, breaks in production)
-
SSO configurations (Azure AD)
Edit: Additionally, If you are using custom app with some portal pages in www folder, check if no_cache = 1 is present or not
Also if you using proxy and load balancer, check how you passing headers.