Search code examples
laravellaravel-routinglaravel-5.1

fix laravel 5 session expiring after refresh or going on another page?


I'm using laravel default Auth. When I login into my website all works great. When I try to refresh or go to another page (still using Auth middleware) my session is expired, I'm directly logged-out and I must login again. How can I fix this so I remain logged in when refreshing the page or browsing to another?


Solution

  • It's worth changing (app/session.php):

    'cookie' => 'laravel_session'
    

    To something relevant to your app/website as it is reset every time the cache is compiled