From 2c9b44aeca279dd0f96ca2d2cea1963ff01e6fd7 Mon Sep 17 00:00:00 2001 From: TaskPool Date: Mon, 27 Jul 2026 03:04:20 +0800 Subject: [PATCH] fix(nginx): add proxy config for /mcp and /open2api endpoints --- nginx-standalone.conf | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/nginx-standalone.conf b/nginx-standalone.conf index bc0ddd7..fb48c6e 100644 --- a/nginx-standalone.conf +++ b/nginx-standalone.conf @@ -9,11 +9,6 @@ server { gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript; gzip_min_length 1000; - # SPA fallback - location / { - try_files $uri $uri/ /index.html; - } - # API proxy - 指向同一容器内的后端 location /api/ { proxy_pass http://127.0.0.1:8052; @@ -24,6 +19,32 @@ server { proxy_set_header X-Real-IP $remote_addr; } + # MCP Server proxy - AI Agent 接入 + location /mcp { + proxy_pass http://127.0.0.1:8052; + 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; + # 支持 SSE 流式响应 + proxy_buffering off; + proxy_cache off; + } + + # OpenAPI proxy + location /open2api/ { + proxy_pass http://127.0.0.1:8052; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + # SPA fallback + location / { + try_files $uri $uri/ /index.html; + } + # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { expires 1y;