fix(kong,nginx): fix API routing configuration

- nginx: preserve full path when proxying to Kong (remove trailing /)
- nginx: increase API timeout to 120s for AI streaming
- kong: use format_version 2.1 for Kong 3.4 compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-09 19:38:32 -08:00
parent b4a84b76fc
commit 462bd64651
2 changed files with 7 additions and 6 deletions

View File

@ -13,7 +13,7 @@
#
#===============================================================================
_format_version: "3.0"
_format_version: "2.1"
_transform: true
#===============================================================================

View File

@ -53,17 +53,18 @@ server {
location /api/ {
# 使用变量实现动态解析,避免启动时服务不可用导致失败
set $kong_upstream kong:8000;
proxy_pass http://$kong_upstream/;
# 保留完整路径传递给 Kong (包括 /api/ 前缀)
proxy_pass http://$kong_upstream;
proxy_http_version 1.1;
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_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
# 超时设置 (增加以支持 AI 流式响应)
proxy_connect_timeout 120s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
# 缓冲设置
proxy_buffering on;