From 4a378ef75dbe454009a4ebf6116aeb6ac76452b6 Mon Sep 17 00:00:00 2001 From: jianghao <332515344@qq.com> Date: Fri, 27 Feb 2026 11:04:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(nginx):=20=E6=B7=BB=E5=8A=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=9C=8D=E5=8A=A1=E6=8E=A5=E5=8F=A3=E7=9A=84API?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为/api/file/路径添加代理配置,使其能够正确转发请求到本地文件服务。保持与其他接口一致的请求头设置,确保请求信息完整传递。 --- nginx.conf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nginx.conf b/nginx.conf index 5c91b9f..8aadf3f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -38,6 +38,19 @@ http { proxy_set_header Authorization $http_authorization; proxy_pass http://localhost:33333/file/; } + # ============================================ + # 文件服务接口 (/file/*) + # ============================================ + location /api/file/ { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header Authorization $http_authorization; + proxy_pass http://localhost:33333/file/; + } # ============================================ # Story 相关接口 (/api/story/*)