During the work to add custom headers when proxying, I think a regression occurred: the host header from the request is passed through to the backend if no custom header value is set. In many cases, this will result in the target service rejecting the request.
Hm, looks strange indeed. I think the host header should be the provided/configured value, or the backend value (in that order). But never the request value. Right?
During the work to add custom headers when proxying, I think a regression occurred: the host header from the request is passed through to the backend if no custom header value is set. In many cases, this will result in the target service rejecting the request.
At https://github.com/trunk-rs/trunk/blob/91ea5636d51489c410c5891983d7b4b10fde3b4b/src/proxy.rs#L173 there is a check for if the
HOST
header is set. However, this is an amalgamation of both request headers and added headers at this point, so it is generally true.Ideally, the authority of the upstream would be used in the default case where there is no custom header for
HOST
.