更新 Dockerfiles/Dockerfile-public/default.conf

This commit is contained in:
2026-09-15 11:31:44 +08:00
parent d6d4fb2885
commit cbedb66bff
+26 -8
View File
@@ -1,27 +1,45 @@
server { server {
listen 80; listen 80;
server_name localhost; server_name _;
client_max_body_size 100m; client_max_body_size 100m;
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html; index index.html;
location / { add_header X-Robots-Tag "noindex, nofollow" always;
try_files $uri $uri/ /index.html;
# 公开构建中的 sw.js 只负责注销该域名历史遗留的后台 PWA。
location = /sw.js {
add_header Cache-Control "no-store, no-cache, must-revalidate";
try_files $uri =404;
} }
location /api/open/onboarding/ { location = /index.html {
add_header Cache-Control "no-store, no-cache, must-revalidate";
try_files $uri =404;
}
# 员工域名只允许入职公开接口。内部后端路由不包含外层 /api。
location ^~ /api/open/onboarding/ {
proxy_pass http://onboardx-api-svc:5566/open/onboarding/; proxy_pass http://onboardx-api-svc:5566/open/onboarding/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_request_buffering off;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s; proxy_connect_timeout 60s;
proxy_read_timeout 300s; proxy_read_timeout 300s;
proxy_send_timeout 300s; proxy_send_timeout 300s;
} }
}
# 公开域名拒绝系统、后台业务及其他 API。
location ^~ /api/ {
return 404;
}
# Hash 路由的有效链接在服务器看来也是根路径,必须返回公开版 index.html。
location / {
try_files $uri $uri/ /index.html;
}
}