Laravel - Back button close the session

446 views Asked by At

This kind of problem only happens in a specific view where I generated reports.

When I generated the report it seems to be okay, but when I tried to return to the previous page where I put the data to generated the report, instead of return to the page, it returns to the login. Then I log again to try to generate the report, but this time it show me the view of The page has expired due to inactivity. Please refresh and try again.

Honestly I don't know what happened here, because the controller of the report, doesn't have anything to cause this. This is random, sometimes it return to the page to generated the reports, but obviously this is a bit problem.

I think it has to be a problem of the cache, but i'm not pretty sure.

CACHE_DRIVER=array
SESSION_DRIVER=file
2

There are 2 answers

0
Gammer On

After generating the report you can forget any specific key of the session or flush everything.

$request->session()->forget('key');

$request->session()->flush();
1
Muhammad Abad On

I'm wracking my brains. I'm sure I've seen this before and it was something to do with Session Cookie Domain

'domain' => env('SESSION_DOMAIN', null),

try by changing this peace of code in session.php file