Skip to content

Commit

Permalink
Force revalidation headers when user logs out
Browse files Browse the repository at this point in the history
Signed-off-by: snipe <snipe@snipe.net>
  • Loading branch information
snipe committed Oct 4, 2021
1 parent 244616b commit 9b48732
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Http/Kernel.php
Expand Up @@ -23,6 +23,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\CheckForDebug::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\SecurityHeaders::class,
\App\Http\Middleware\PreventBackHistory::class,

];

Expand Down
23 changes: 23 additions & 0 deletions app/Http/Middleware/PreventBackHistory.php
@@ -0,0 +1,23 @@
<?php

namespace App\Http\Middleware;

use Closure;

class PreventBackHistory
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
return $response->header('Cache-Control','no-cache, no-store, max-age=0, must-revalidate')
->header('Pragma','no-cache')
->header('Expires','Sun, 02 Jan 1990 00:00:00 GMT');
}
}

0 comments on commit 9b48732

Please sign in to comment.