Reputation: 383
Here is my routes.php
<?php
#HomePage
Route::get('/', 'LoginController@home');
Route::post('login', 'LoginController@Login');
Route::group(array('before' => 'auth'), function()
{
Route::get('home', 'HomeController@HomeLayout');
Route::get('logout', 'LoginController@Logout');
});
In the logout i have
public function Logout()
{
Session::flush();
return Redirect::to('');
}
Once i do logout i am succesfully redirected to ''
page i.e., localhost/home as i have this in my logincontroller
public function home()
{
return View::make('login/home');
}
My Problem is once i press the logout and i press the back button i can able to see the localhost/home though i have used it inside the Route::group(array('before' => 'auth'), function()
I also configured the filters.php
Route::filter('guest', function()
{
if (Auth::check()) return Redirect::to('/')->with('Message', 'Please Login to get Access');
});
and
Route::filter('auth', function()
{
if (Auth::guest())
{
if (Request::ajax())
{
return Response::make('Unauthorized', 401);
}
else
{
return Redirect::guest('')->with('Message', 'Please Login to get Access');
}
}
});
Note : Once i refresh it directs to logout , but i don't even want to display the home even before they do refresh
How can i prevent displaying the home screen after pressing back button from browser once they logged out ?
Upvotes: 0
Views: 159
Reputation: 21901
App::after(function($request, $response)
{
$response->headers->set('Cache-Control','nocache, no-store, max-age=0, must-revalidate');
$response->headers->set('Pragma','no-cache');
$response->headers->set('Expires','Fri, 01 Jan 1990 00:00:00 GMT');
});
add these lines in routes.php
and check.
this will clear the cache
Upvotes: 1