You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ReverseProxy makes an attempt at not modifying the original req.Header
// We are modifying the same underlying map from req (shallow// copied above) so we only copy it if necessary.copiedHeaders:=false
However it skips the check for X-Forwarded-For
outreq.Header.Set("X-Forwarded-For", clientIP)
But more importantly, Director is called on the shallow copied req, and the NewSingleHostReverseProxy one modifies req.Header without making a new map
if_, ok:=req.Header["User-Agent"]; !ok {
// explicitly disable User-Agent so it's not set to default valuereq.Header.Set("User-Agent", "")
}
It looks to me like this is useless unless it's consistent. It should either make a new Header map before calling Director, or make no attempt at copying them at all.
Not a regression, even if 24d8f3f is a partial fix.
I linked #18326 because I expect it to end up into a discussion of whether you are supposed to modify req.Header, which is relevant to this issue. (And also because it's how I found #18326.)
ReverseProxy makes an attempt at not modifying the original req.Header
However it skips the check for
X-Forwarded-For
But more importantly, Director is called on the shallow copied req, and the NewSingleHostReverseProxy one modifies
req.Header
without making a new mapIt looks to me like this is useless unless it's consistent. It should either make a new Header map before calling Director, or make no attempt at copying them at all.
See also #18326
The text was updated successfully, but these errors were encountered: