From d3c8f5643cf08dea9cd977e508d6dab4d621463b Mon Sep 17 00:00:00 2001 From: XOF Date: Mon, 15 Dec 2025 05:35:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20proxy/rewriter.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy/rewriter.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/proxy/rewriter.go b/proxy/rewriter.go index 466ce3b..765cb31 100644 --- a/proxy/rewriter.go +++ b/proxy/rewriter.go @@ -125,6 +125,11 @@ func (r *ContentRewriter) rewriteURL(urlStr string) string { return urlStr } + // 已经是代理 URL,直接返回 + if strings.HasPrefix(urlStr, "/p/"+r.token+"/") { + return urlStr + } + // 处理协议相对 URL(//domain.com/path) if strings.HasPrefix(urlStr, "//") { urlStr = r.baseURL.Scheme + ":" + urlStr @@ -152,10 +157,10 @@ func (r *ContentRewriter) rewriteURL(urlStr string) string { } // 跨域资源,完整 URL - return "/p/" + r.token + "/" + u.String() + fullURL := u.String() + return "/p/" + r.token + "/" + fullURL } - func (r *ContentRewriter) rewriteSrcset(srcset string) string { if srcset == "" { return srcset