From d46840c2c9f021837755a50cb19d3c000b3ea8fa Mon Sep 17 00:00:00 2001 From: tbphp Date: Sun, 8 Jun 2025 14:40:48 +0800 Subject: [PATCH] fix: proxy url --- internal/proxy/proxy.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/proxy/proxy.go b/internal/proxy/proxy.go index a648f59..f802f55 100644 --- a/internal/proxy/proxy.go +++ b/internal/proxy/proxy.go @@ -410,7 +410,12 @@ func (ps *ProxyServer) executeRequestWithRetry(c *gin.Context, startTime time.Ti // 构建上游请求URL targetURL := *ps.upstreamURL - targetURL.Path = c.Request.URL.Path + // 正确拼接路径,而不是替换路径 + if strings.HasSuffix(targetURL.Path, "/") { + targetURL.Path = targetURL.Path + strings.TrimPrefix(c.Request.URL.Path, "/") + } else { + targetURL.Path = targetURL.Path + c.Request.URL.Path + } targetURL.RawQuery = c.Request.URL.RawQuery // 为流式和非流式请求使用不同的超时策略