dever 5 年之前
父节点
当前提交
0d983d244e
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      container/conf/web/nginx/conf.d/site.conf

+ 8 - 0
container/conf/web/nginx/conf.d/site.conf

@@ -14,6 +14,14 @@ server {
     gzip_vary on;
     gzip_disable "MSIE [1-6]\.";
 
+    add_header Access-Control-Allow-Origin *;
+    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
+    add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
+
+    if ($request_method = 'OPTIONS') {
+        return 204;
+    }
+
     location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
             add_header Access-Control-Allow-Origin *;
             add_header Access-Control-Allow-Headers X-Requested-With;