Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel, sudenly changed the session to other users?

Did you have any experience with this weird thing, I have logged in with "Foo" user When I refresh the page or click another menu page, the current logged user changing to "Bar" user suddenly.

I have change session_name/cookie_name at config/session.php to unique name, set "encrypt" to true,

The issue is similar to this https://github.com/crocodic-studio/crudbooster/issues/1073

Maybe there any other configuration that I have to set?

Thank You.

like image 969
wpro Avatar asked Apr 06 '18 11:04

wpro


2 Answers

What kind of environment are you experiencing this on? Is this local or some kind of cloud hosting where load balancing could happen?

The issue could be that you have a load balancer in front of your backend. After you refresh, you get to another backend and create a new session. Check your session.php and try using the database driver (read https://laravel.com/docs/5.6/session#configuration)

like image 182
Dalsh Avatar answered Sep 28 '22 02:09

Dalsh


Is your server using web accelelator? Or litespeed? You need to disable cache.. Im using this CacheDisable public / CacheDisable private / Add it to my .htaccess Hope it helps. NB sorry for my bad english

like image 30
galih tresnandika Avatar answered Sep 28 '22 01:09

galih tresnandika