-
Notifications
You must be signed in to change notification settings - Fork 353
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
Set host header in order to use it in another route lookup #2038
Comments
The thing is that go http.Server does not put "Host" into http.Request.Header but sets http.Request.Host, see https://pkg.go.dev/net/http#Request
For setRequestHeader (and friends) we have a special case for "Host" which sets context OutgoingHost field and (rather incorrectly) adds Host to the Headers: skipper/filters/builtin/headerfilter.go Lines 262 to 269 in 7cb3dc2
This is how example ends up logging two Hosts: one is req.Host and another is from Headers: skipper/filters/diag/logheader.go Lines 102 to 115 in 7cb3dc2
Loopback routing is based on the ctx.Request().Host and does not use ctx.OutgoingHost field. |
Should not we better "fix" the |
Yeah, I think we can also set
Not adding Host to Headers could be a breaking change so I guess we should keep it like it is. |
Looks like duplicate of #1604 |
If you add
dropRequestHeader("Host") -> setRequestHeader("Host", "bar") -> <loopback>
the new host "bar" is not replacing the host header, but appending it. This works differently from the network backend.Example
network backend:
The text was updated successfully, but these errors were encountered: