fix: Nginx 配置添加 Swagger/Knife4j API 文档代理

在 emotion-museum.conf 中新增 /swagger-ui、/v3/api-docs、/doc.html、/webjars
代理规则,防止前端 try_files 拦截导致 API 文档页面无法访问。

修复后文档地址:
- Swagger UI: https://lifescript.happylifeos.com/api/swagger-ui/index.html
- Knife4j: https://lifescript.happylifeos.com/api/doc.html

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-20 22:08:35 +08:00
parent ee5a6aba5d
commit 492c09feeb
+33
View File
@@ -131,6 +131,39 @@ server {
proxy_read_timeout 60s;
}
# Swagger UI / Knife4j API 文档代理(防止被前端 try_files 拦截)
location /swagger-ui {
proxy_pass http://127.0.0.1:19089;
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;
}
location /v3/api-docs {
proxy_pass http://127.0.0.1:19089;
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;
}
location /doc.html {
proxy_pass http://127.0.0.1:19089;
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;
}
location /webjars {
proxy_pass http://127.0.0.1:19089;
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;
}
# WebSocket 代理
location /ws {
proxy_pass http://127.0.0.1:19089;