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
I think Request.Header["Host"] should not be deleted when parsing the request.
For example, if I use the net/http to write a proxy server, listening on 127.0.0.1:8080, and issue the following command: curl --proxy "127.0.0.1:8080" -H "Host: domain.com" "http://130.130.10.10/ping"
The proxy should deliver the Host header to origin server 130.130.10.10, but it's already deleted by Request.ReadRequest() when reading request from client(https://golang.org/src/net/http/request.go?h=http#L714). In this case, if the origin server is configured as a nginx virtual server server_name domain.com, it will return 404 because of mismatching host name.
The text was updated successfully, but these errors were encountered:
It's been like that for ages. Changing it now, regardless of whether it's a good idea, would be a incompatible change.
In any case, you seem to have a concrete problem about writing a proxy. Let's discuss that instead on one of the forums: https://golang.org/wiki/Questions
I think Request.Header["Host"] should not be deleted when parsing the request.
For example, if I use the net/http to write a proxy server, listening on
127.0.0.1:8080
, and issue the following command:curl --proxy "127.0.0.1:8080" -H "Host: domain.com" "http://130.130.10.10/ping"
The proxy should deliver the
Host
header to origin server130.130.10.10
, but it's already deleted by Request.ReadRequest() when reading request from client(https://golang.org/src/net/http/request.go?h=http#L714). In this case, if the origin server is configured as a nginx virtual serverserver_name domain.com
, it will return 404 because of mismatching host name.The text was updated successfully, but these errors were encountered: