From fb0cf7244674469239b49e538ad40bc1b3bdaea7 Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Sat, 27 Jun 2026 18:50:46 +0800 Subject: [PATCH] fix(forwarder): record post-rewrite URI in HTTP recorder After RewriteURL mutates req.URL.Path, ro.HTTP.URI still held the pre-rewrite value because the recorder object was initialized before the rewrite loop. Update ro.HTTP.URI to match the rewritten path so the recorded HTTP request reflects the URI actually sent upstream. --- internal/util/forwarder/sniffer_http.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/util/forwarder/sniffer_http.go b/internal/util/forwarder/sniffer_http.go index a037cf77..9748b20f 100644 --- a/internal/util/forwarder/sniffer_http.go +++ b/internal/util/forwarder/sniffer_http.go @@ -356,6 +356,7 @@ func (h *Sniffer) httpRoundTrip(ctx context.Context, rw, cc io.ReadWriteCloser, if re.Pattern.MatchString(req.URL.Path) { if s := re.Pattern.ReplaceAllString(req.URL.Path, re.Replacement); s != "" { req.URL.Path = s + ro.HTTP.URI = req.URL.RequestURI() break } }