I am still waiting for an answer, or some suggestion at least, what I realized is from a single page application point of view using inertia and jetstream on laravel, server-side everything is working fine. The issue is on the client's browser which is storing the history. how to prevent or clear it?
Prevent Browser's Back Button Login After Logout in Laravel 8, vue jetstream
Hi, I wanted to know is there any alternative to prevent users to block from going to the previous page after logging out. I know the user is logged out after you click on logout, but still, if there is any sensitive information, it can be viewed after you click on the back button. I am using larvael 8 with vue, jetstream and inertia.js. I tried with Laravel middleware with no-cache but still no luck. Below is my code in middleware
public function handle($request, Closure $next)
{
$response = $next($request);
$response->headers->set('Cache-Control','nocache, no-store, max-age=0, must-revalidate');
$response->headers->set('Pragma','no-cache');
$response->headers->set('Expires','Sun, 02 Jan 1990 00:00:00 GMT');
return $response;
}'
Kernel
protected $routeMiddleware = [
.
.
.
'preventBackHistory' => \App\Http\Middleware\PreventBackHistory::class,
];
and i use this middleware for all auth routes after registering it in kernel. Still it takes me back to the previous page if i hit back after logging out. I think using above method of clearing chahe also brings up the performance issue. So i want to know what is the best possible way to achieve this. Thanks in advance.
Please or to participate in this conversation.