This commit is contained in:
孙小云 2025-06-28 15:24:06 +08:00
parent 5e1af8ae70
commit 1b5ce4f8f9
1 changed files with 34 additions and 0 deletions

View File

@ -40,6 +40,40 @@
}
location /airport {
# 先清除后端返回的 CORS 相关头
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
proxy_hide_header Access-Control-Allow-Headers;
proxy_hide_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Max-Age;
proxy_hide_header Access-Control-Expose-Headers;
add_header 'Access-Control-Allow-Origin' "https://${BUSINESS_DOMAIN_FULL}" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, X-Requested-With, client-id' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Max-Age' 1728000 always;
add_header 'Access-Control-Expose-Headers' 'Content-Type, Authorization, client-id' always;
add_header 'Vary' 'Origin' always;
add_header 'Content-Security-Policy' "frame-ancestors *" always;
add_header X-Frame-Options ALLOWALL always;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "https://${BUSINESS_DOMAIN_FULL}" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, X-Requested-With, client-id' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Max-Age' 1728000 always;
add_header 'Access-Control-Expose-Headers' 'Content-Type, Authorization, client-id' always;
add_header 'Vary' 'Origin' always;
add_header 'Content-Security-Policy' "frame-ancestors *" always;
add_header X-Frame-Options ALLOWALL always;
add_header 'Content-Length' 0;
add_header 'Content-Type' 'text/plain; charset=utf-8';
return 204;
}
proxy_pass http://gatewayService/airport;
proxy_set_header Host $host;
proxy_http_version 1.1;