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
But this is not 100% correct. The request.URL is the results of parsing the URI in the HTTP request which will usually be relative to the HTTP Host header. See the following comment from the go docs: https://pkg.go.dev/net/http@go1.18#Request
// URL specifies either the URI being requested (for server
// requests) or the URL to access (for client requests).
//
// For server requests, the URL is parsed from the URI
// supplied on the Request-Line as stored in RequestURI. For
// most requests, fields other than Path and RawQuery will be
// empty. (See RFC 7230, Section 5.3)
//
// For client requests, the URL's Host specifies the server to
// connect to, while the Request's Host field optionally
// specifies the Host header value to send in the HTTP
// request.
URL *url.URL
The code should check the result of request.URL.IsAbs() before deciding to use either request.Host or request.URL.Host
The text was updated successfully, but these errors were encountered:
Thanks for opening an issue!
Interesting, this does appear to be a bug in how we create the http.host tag. Is it worth checking for request.URL.IsAbs() at all? It feels like we can just always use request.Host if it's set since it should always be set on the server side. Or am I missing something in the docs you linked?
In
contrib/net/http.go
thehttp.host
tag is set via the following code:But this is not 100% correct. The request.URL is the results of parsing the URI in the HTTP request which will usually be relative to the HTTP Host header. See the following comment from the go docs: https://pkg.go.dev/net/http@go1.18#Request
The code should check the result of
request.URL.IsAbs()
before deciding to use eitherrequest.Host
orrequest.URL.Host
The text was updated successfully, but these errors were encountered: