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:
@@ -356,6 +356,7 @@ func (h *Sniffer) httpRoundTrip(ctx context.Context, rw, cc io.ReadWriteCloser,
|
|||||||
if re.Pattern.MatchString(req.URL.Path) {
|
if re.Pattern.MatchString(req.URL.Path) {
|
||||||
if s := re.Pattern.ReplaceAllString(req.URL.Path, re.Replacement); s != "" {
|
if s := re.Pattern.ReplaceAllString(req.URL.Path, re.Replacement); s != "" {
|
||||||
req.URL.Path = s
|
req.URL.Path = s
|
||||||
|
ro.HTTP.URI = req.URL.RequestURI()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user