企业微信外部联系人同步
This commit is contained in:
@@ -47,14 +47,15 @@ class LikeAdminAllowMiddleware
|
||||
*/
|
||||
public function handle($request, Closure $next, ?array $header = []): mixed
|
||||
{
|
||||
// 如果是OPTIONS预检请求,直接返回成功响应,不继续处理
|
||||
if (strtoupper($request->method()) === 'OPTIONS') {
|
||||
$this->setCorsHeaders();
|
||||
return response('', 200);
|
||||
}
|
||||
|
||||
// 设置跨域头
|
||||
$this->setCorsHeaders();
|
||||
|
||||
// 如果是OPTIONS请求,直接返回响应
|
||||
if (strtoupper($request->method()) === 'OPTIONS') {
|
||||
return response();
|
||||
}
|
||||
|
||||
// 安装检测
|
||||
$install = file_exists(root_path() . '/config/install.lock');
|
||||
if (!$install) {
|
||||
@@ -72,10 +73,11 @@ class LikeAdminAllowMiddleware
|
||||
*/
|
||||
private function setCorsHeaders(): void
|
||||
{
|
||||
$origin = $_SERVER['HTTP_ORIGIN'] ?? '*';
|
||||
$headers = [
|
||||
'Access-Control-Allow-Origin' => '*',
|
||||
'Access-Control-Allow-Origin' => $origin,
|
||||
'Access-Control-Allow-Headers' => implode(', ', self::ALLOWED_HEADERS),
|
||||
'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, post',
|
||||
'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS',
|
||||
'Access-Control-Max-Age' => '1728000',
|
||||
'Access-Control-Allow-Credentials' => 'true'
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user