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
A server MUST respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that lacks a Host header field and to any request message that contains more than one Host header field or a Host header field with an invalid field-value
I'm guessing the spec deviation is intentional to support some legacy clients. Would you be open to adding a check_host_header option?
I'm guessing the spec deviation is intentional to support some legacy clients.
I want to say it was on purpose. But my memory is hazy on the subject (sigh, these things should be documented). I think while working on linkerd, we wanted a transparent proxy that only rejected things that were horribly wrong, but otherwise, you shouldn't notice it. If a system was working with wonky host headers, who were we to break it?
It also felt like one of those requirements that could be validated by the user code if they cared, but if they didn't, why should we spend the processing on it? As opposed to message size headers, which affect framing, host headers seemed less consequential. If your server cares about the host, then most likely you'll have to handle a missing host anyways.
Additionally, with the way RFC 9113 talks about allowed missing :authority fields, and that :authority should be used if translating to HTTP/1, it seemed like there could be instances where there is no host header. Indeed, the part you pointed out (which still exists in the newer 9110/9112), it sounds like even if you don't know a host, you should send host: with an empty value. Elsewhere in 9112, there's mention "If there is no Host header field or if its field value is empty or invalid, the target URI's authority component is empty."
So, in short, I don't know. Could use more discussion. If it must be fixed in hyper, we can. If there isn't a demanding reason, then at least we should document that.
Hyper currently allows processing requests without and with multiple Host headers.
As per rfc7230 3.3.3:
I'm guessing the spec deviation is intentional to support some legacy clients. Would you be open to adding a
check_host_header
option?As prior art: Node.js changed it's behavior to follow spec strictly and added option to disable host header checks.
The text was updated successfully, but these errors were encountered: