Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: document outgoing Host header origin in more places #34124
What version of Go are you using (
changed the title
net/http does not set http.Request.Host when we add Host header.
Sep 10, 2019
We can document the current behavior more, but I'm very reluctant to change the behavior more at this point.
We currently have two fields we consult for the Host header. First Request.Host, else Request.URL.Host.
This is documented on Request.URL:
We could document that more on Request.Header and Request.Host too.
You're proposing to add a third level in there (Request.Header["Host"]) between the Request.Host and Request.URL.Host. That might be intuitive to some, but it's also just more complexity and compatibility support to maintain going forward. (And might catch other implementations by surprise?)
So we probably shouldn't do anything.
I'd accept a documentation change, though.