2021-10-08 16:22:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
|
2023-10-23 14:32:15 +02:00
|
|
|
class PreventResponseCaching
|
2021-10-08 16:22:09 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
2021-10-08 23:23:17 +02:00
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Closure $next
|
|
|
|
*
|
2021-10-08 16:22:09 +02:00
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle($request, Closure $next)
|
|
|
|
{
|
|
|
|
/** @var Response $response */
|
|
|
|
$response = $next($request);
|
|
|
|
|
2023-10-23 14:32:15 +02:00
|
|
|
$response->headers->set('Cache-Control', 'no-cache, no-store, private');
|
|
|
|
$response->headers->set('Expires', 'Sun, 12 Jul 2015 19:01:00 GMT');
|
2021-10-08 16:22:09 +02:00
|
|
|
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
}
|