My problem is i can logout properly after i click to logout link but if i click to back button of the browser, still able to see the content of the page which actually should not be seen with respect to my auth middleware process. I read i can prevent this by disabling caching but don't think it is the best way to do this so how can i make this in a better way ?MY Logout Function is
public function logout()
{
Auth::logout();
Session::flush();
return redirect('login');
}
My Route Is:
Route::get('logout','Homecontroller@logout');
Thanx In advance
This problem is with the browser. The browser caches the content of the page and serves that cached content to the user when you are hitting the back button.
Set up cache-control meta tags on the pages that requires that a user is logged in. That way you are telling the browser not to cache it.
E.g:
<meta http-equiv="cache-control" content="private, max-age=0, no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With