Properly support HTTP/1.1 with non-http scheme absolute-uri and empty Host header #7278
Labels
Bug
For general bugs on Jetty side
Specification
For all industry Specifications (IETF / Servlet / etc)
Jetty version(s)
9+
Java version/vendor
(use: java -version)
All
OS type/version
All
Description
In the process of investigating the
HostHeaderCustomizer
in issue #7250 and theHostPort
implementation in issue #7269 it was discoveredthat our handling of empty
Host
header is wholly invalid and introduces a side effect on HTTP/1.1 requests that causes the exposureof internal server ip to on requests forwarded through intermediaries as identified in issue #7277
Per the HTTP/1.1 spec section on
Host
https://datatracker.ietf.org/doc/html/rfc7230#section-5.4
Basically, on HTTP/1.1 the rules for the
Host
header are ...Host
header field MUST always be presentHost
header value MUST be the same as the absolute URI authority (even empty).Host
header value MUST be a valid authority with a defined "host" portion.If you don't satisfy those requirements, the request results in a 400 Bad Request.
We do a good job on rule 1 already.
We fail rule 2.
However the above mentioned issues show we fail on rule 3.
The same above mentioned Issues will address rules 1 and 3, but this issue needs to address rule 2 separately.
The text was updated successfully, but these errors were encountered: