net/http/request: distinguish request target and host header when using proxy #43588
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?go version go1.14.6 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
According to RFC 7230, absoluteURI should be passed when using proxy. When i set Host header, the host in absoluteURI is rewrote by the header, which is not acceptable. For example, using curl as follows:
When capturing the traffic, we could get packet like this:
While using http.Proxy in Go, i can set host by setting request.Host, but it cannot preserve original Host in absoluteURI.
Packet captured is like this:
Sometimes Host header can be used to verify the request, and Host is not equal with host domain in such case. I know proxy should rewrite Host according to RFC, but i think it's acceptable to distinguish host header and host in absoluteURI.
What did you see instead?
Maybe the user defined host won't rewrite the host in absoluteURI.
https://github.com/golang/go/blob/master/src/net/http/request.go#L585
The text was updated successfully, but these errors were encountered: