返回 Bug 清单
BUG-0452project-04高已修复deploy-config

Nginx 把 Web 静态 + API 全部 proxy 到后端 (缺分层)

发现:2026-10-04验证:2026-10-31置信度:70%

症状

所有流量 (含 3.6MB 前端静态) 都经 FastAPI; SSE 流式 AI 对话没单独配置; nginx 失去了静态文件强缓存能力

根因

部署时 nginx conf 只用一个 location / 把所有请求 (Web dist/ 静态 + API + SSE) 都 proxy 到 FastAPI 后端 —— 没建立分层认知: 前端静态应该让 nginx 直接 serve (含 Vue Router history 回退 + 强缓存), API/SSE 走后端, SSE 单独需要 proxy_buffering off + 300s timeout

修复方案

重写 nginx-auditor.conf 为三层分流: ① /v1/api/ + /evidence_files/ → FastAPI 19520 ② 含 SSE 的路径单独 location + proxy_buffering off 300s timeout ③ /* → root /var/www/auditor + try_files $uri → /index.html + JS/CSS 强缓存 1 年 + HTML 不缓存

错误签名

proxy_pass http://127.0.0.1:19520 (nginx location /)

技术信息

来源项目

project-04

涉及文件

deploy/nginx-auditor.conf

标签

nginx, deploy, frontend, architecture, project-04...