mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
25 lines
540 B
PHP
25 lines
540 B
PHP
<?php
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
|
|
class FrameGuard
|
|
{
|
|
/**
|
|
* Handle the given request and get the response.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
$response = $next($request);
|
|
if (config('app.allow_iframing') == false) {
|
|
$response->headers->set('X-Frame-Options', 'SAMEORIGIN', false);
|
|
}
|
|
return $response;
|
|
|
|
}
|
|
}
|