9501751792
三轮审查修复(60+ 项),相对远端 main(b536672)的关键变更:
- 安全: 数据面 SSRF 拨号防护(防 DNS rebinding)/上游凭据剥离/登录防枚举
与锁定态统一/可信代理(X-Forwarded-For)限流加固/会话版本失效机制/
撤销即时传播/弱密钥拒绝启动/脱敏字节级重写(保签名契约)
- 业务逻辑: 裸 body 上传 panic/bootstrap 审计管线卡死/定价通配符优先级/
全局工具可见性/调度器停机补跑/TOTP 挑战令牌消费顺序/熔断探针语义/
>4MB 响应 token 计量/管理员重置密码作废会话 等
- 前端: 新 logo(语枢 AI 网关主题)/Provider 凭据异常警示/删除入口/
后端错误消息透传/localStorage 敏感数据收敛
- 部署: CREDENTIAL_MASTER_KEY 持久化与弱值拒绝/Provider DELETE 接口/
nginx 安全头/worker 内存限制
- 新增迁移 000029(key_hash 索引)/000030(usage_daily 币种维度)
79 lines
2.7 KiB
Plaintext
79 lines
2.7 KiB
Plaintext
server {
|
||
listen 80;
|
||
server_name _;
|
||
# 不暴露 nginx 版本号(server_tokens 同时影响错误页与 Server 头)。
|
||
server_tokens off;
|
||
|
||
# Keep Location headers relative (Location: /admin/) instead of letting
|
||
# nginx absolute_redirect rebuild them from $host + the listening port.
|
||
# The gateway is commonly published behind a non-standard port (e.g. 18081),
|
||
# and an absolute redirect would drop that port and send browsers to :80.
|
||
absolute_redirect off;
|
||
|
||
# 256 MiB 必须盖过文件上传上限 S3_MAX_FILE_BYTES(默认 128 MiB)。文件体
|
||
# 由网关的流式上传处理器把关(http.MaxBytesReader + LimitReader),
|
||
# nginx 只做最外层限制,避免大文件在到达网关前就被 413 拒绝。
|
||
client_max_body_size 256m;
|
||
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
# 基础安全响应头:防 MIME 嗅探、防点击劫持、限制 Referer 泄露来源页面。
|
||
add_header X-Content-Type-Options nosniff always;
|
||
add_header X-Frame-Options DENY always;
|
||
add_header Referrer-Policy same-origin always;
|
||
|
||
location = / {
|
||
return 302 /__APP__/;
|
||
}
|
||
|
||
location = /__APP__ {
|
||
return 301 /__APP__/;
|
||
}
|
||
|
||
location = /healthz {
|
||
proxy_pass http://gateway-api:8080/healthz;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
location = /readyz {
|
||
proxy_pass http://gateway-api:8080/readyz;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
location /api/ {
|
||
proxy_pass http://gateway-api:8080;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Request-ID $request_id;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
# nginx 是控制台(/api/)的唯一入口:用 $remote_addr 覆盖 X-Forwarded-For,
|
||
# 避免客户端自带 X-Forwarded-For 头伪造来源 IP、绕过登录限流。
|
||
proxy_set_header X-Forwarded-For $remote_addr;
|
||
}
|
||
|
||
location /v1/ {
|
||
proxy_pass http://gateway-api:8080;
|
||
proxy_http_version 1.1;
|
||
proxy_buffering off;
|
||
proxy_read_timeout 600s;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Request-ID $request_id;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
# Vite emits assets and client-side routes below /admin/ or /portal/.
|
||
location /__APP__/ {
|
||
try_files $uri $uri/ /__APP__/index.html;
|
||
}
|
||
|
||
location / {
|
||
return 404;
|
||
}
|
||
}
|