mirror of
https://github.com/v2board/v2board.git
synced 2025-06-14 21:57:50 +08:00
format
This commit is contained in:
@ -9,9 +9,9 @@ class CORS
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$origin = $request->header('origin');
|
||||
if(empty($origin)){
|
||||
if (empty($origin)) {
|
||||
$referer = $request->header('referer');
|
||||
if(!empty($referer)&&preg_match("/^((https|http):\/\/)?([^\/]+)/i", $referer, $matches)){
|
||||
if (!empty($referer) && preg_match("/^((https|http):\/\/)?([^\/]+)/i", $referer, $matches)) {
|
||||
$origin = $matches[0];
|
||||
}
|
||||
}
|
||||
@ -21,7 +21,7 @@ class CORS
|
||||
$response->header('Access-Control-Allow-Headers', 'Content-Type,X-Requested-With');
|
||||
$response->header('Access-Control-Allow-Credentials', 'true');
|
||||
$response->header('Access-Control-Max-Age', 10080);
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user