-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide the Host value to handlers #513
Comments
It looks like the reverse flow is also problematic: the Go "net/http" client ignores a header key of "Host", instead requiring the caller to set the |
Allows Host to set the request.Host on the client and promotes request.Host back to a Header in the handler. Fixes #513
@ymmt2005 fixed in a similar way to the workaround. Host is available in the request header. |
@emcfarlane Thank you so much! |
Allows Host to set the request.Host on the client and promotes request.Host back to a Header in the handler. Fixes #513
I wanted to use the
Host
field value of thehttp.Request
in my application.Since Go does not set
Host
header inhttp.Header
, connect-go handlers cannotaccess this information.
ref: https://cs.opensource.google/go/go/+/refs/tags/go1.20.4:src/net/http/request.go;l=157-158
Describe the solution you'd like
It would be great if
connect.Request
provided the Host field value in thehttp.Request
.For example,
Describe alternatives you've considered
My current workaround is to wrap the HTTP handler returned by
NewXXX
generated function like:This way, I can access the Host value from handlers with
req.Header().Get("Host")
.The text was updated successfully, but these errors were encountered: