cmbYouku_Api/app/middleware/CorsMiddleware.php

23 lines
681 B
PHP

<?php
declare (strict_types=1);
namespace app\middleware;
/**
* @author canny
* @date 2023/10/27 17:20
**/
namespace app\middleware;
use think\middleware\AllowCrossDomain;
class CorsMiddleware extends AllowCrossDomain
{
protected $header = [
'Access-Control-Allow-Credentials' => 'true',
'Access-Control-Max-Age' => 1800,
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'GET,POST,PATCH,PUT,DELETE,OPTIONS',
'Access-Control-Allow-Headers' => 'Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-CSRF-TOKEN,X-Requested-With,token,front-token',
];
}