update cross origin config

This commit is contained in:
moicen
2022-01-20 20:48:00 +08:00
parent bfe28d5c5a
commit dfdd1795f5
+12 -6
View File
@@ -28,6 +28,18 @@ server {
root $resty_loc/nginx/html/admin;
index index.html;
if ($http_origin !~ [a-z]+\.moicen\.com$) {
return 403;
}
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'Authorization,unionid,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Max-Age 86400;
if ($request_method = 'OPTIONS') {
return 200;
}
#Upload image files
location /api/ngx/image/upload {
content_by_lua_file $resty_loc/resty_funcs/upload.lua;
@@ -47,16 +59,10 @@ server {
location /api/v1/ws/ {
proxy_pass http://127.0.0.1:3001/api/v1/ws/;
proxy_set_header Host $host;
}
location /api/v1/uc/ {
proxy_pass http://127.0.0.1:3000/api/v1/uc/;
proxy_set_header Host $host;
}
# location /api/v1/ts/ {
# proxy_pass http://127.0.0.1:8080/api/v1/ts/;
# proxy_set_header Host $host;
# }
}
server {