Files
2026-07-10 21:10:17 +08:00

67 lines
2.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 80;
server_name cadb.dvb.corpinter.net.cn;
client_max_body_size 100M;
# root /usr/share/nginx/html;
include /etc/nginx/mime.types;
# 处理OPTIONS请求
# location / {
# if ($request_method = 'OPTIONS') {
# add_header 'Access-Control-Allow-Origin' '*' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
# add_header 'Access-Control-Max-Age' 1728000 always;
# add_header 'Content-Type' 'text/plain; charset=utf-8' always;
# add_header 'Content-Length' 0 always;
# return 204;
# }
# try_files $uri $uri/ /index.html;
# }
location / {
root /usr/share/nginx/html; # 末尾无斜杠
try_files $uri $uri/ /index.html;
}
location /accidentportal/ {
rewrite ^/accidentportal/(.*)$ /$1 last;
}
# 修复API代理
location /accidentportal/api/ {
# rewrite ^/api(.*)$ $1 break;
# proxy_pass http://150.158.236.152:5221/; # 注意结尾斜杠
proxy_buffer_size 128k;
proxy_buffers 16 128k;
proxy_busy_buffers_size 256k;
proxy_max_temp_file_size 1024m;
proxy_pass https://cadb.dvb.corpinter.net.cn/accidentportal/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
# 关键:Cookie处理
proxy_cookie_path / "/; SameSite=Lax";
}
# 图片/上传(IMAGE_BASE_URL + file_path 拼成 /uploads/...
location /accidentportal/uploads/ {
proxy_pass https://cadb.dvb.corpinter.net.cn/accidentportal/uploads/;
proxy_set_header Host $host;
}
}