Browse Source

修改跨域适应跨域上传文件

visuddhinanda 3 years ago
parent
commit
3047c63c64
1 changed files with 2 additions and 2 deletions
  1. 2 2
      config/cors.php

+ 2 - 2
config/cors.php

@@ -17,13 +17,13 @@ return [
 
     'paths' => ['api/*'],
 
-    'allowed_methods' => ['GET','POST','PUT','DELETE','PATCH'],
+    'allowed_methods' => ['GET','POST','PUT','DELETE','PATCH','OPTIONS'],
 
     'allowed_origins' => [env('ALLOWED_ORIGINS', 'http://127.0.0.1:3000')],
 
     'allowed_origins_patterns' => [],
 
-    'allowed_headers' => ['content-type','cookie','authorization'],
+    'allowed_headers' => ['content-type','cookie','authorization','x-requested-with'],
 
     'exposed_headers' => [],