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.
This commit is contained in:
ginuerzh committed 2026-06-27 18:50:46 +08:00
1 parent ee7b1e9462
commit fb0cf72446
1 file changed
+1
+1
View File
@@ -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
}
}