92 lines
4.2 KiB
Plaintext
92 lines
4.2 KiB
Plaintext
server
|
|
{
|
|
listen 80;
|
|
listen 443 ssl;
|
|
server_name ${AIRPORT_DOMAIN};
|
|
root /data/tuoheng_airport_web/dist;
|
|
|
|
# SSL证书配置
|
|
ssl_certificate /etc/nginx/t-aaron.com.pem;
|
|
ssl_certificate_key /etc/nginx/t-aaron.com.key;
|
|
ssl_session_timeout 5m;
|
|
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
|
|
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
# 开启gzip功能
|
|
gzip on;
|
|
gzip_min_length 10k;
|
|
gzip_comp_level 9;
|
|
gzip_types text/plain text/css application/javascript application/x-javascript text/javascript application/xml;
|
|
gzip_vary on;
|
|
gzip_disable "MSIE [1-6]\.";
|
|
|
|
add_header X-Frame-Options ALLOWALL;
|
|
|
|
add_header 'Access-Control-Allow-Origin' 'https://${BUSINESS_DOMAIN_FULL}' always;
|
|
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, X-Requested-With' always;
|
|
|
|
|
|
location /{
|
|
try_files $uri $uri/ @router;
|
|
index index.html;
|
|
proxy_redirect http://${AIRPORT_DOMAIN} https://${AIRPORT_DOMAIN_FULL};
|
|
}
|
|
|
|
location @router{
|
|
rewrite ^.*$ /index.html last;
|
|
}
|
|
|
|
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;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location /permission {
|
|
proxy_pass http://airportService/permission;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
} |