-
Notifications
You must be signed in to change notification settings - Fork 44
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
Mismatching absolute URI and Host header #191
Comments
need to cover canonicalization issues around mismatching.. minimally case, but I wonder if fully-qualified is an issue. |
I am not sure if we should require every endpoint to see if there is a mismatch between the authority of the absolute form the value of the host header field. It's going to be costly and complex, because it requires canonicalization (as @mcmanus points out). And assuming that we do not require that, we need to specify which one takes precedence when absolute form is being used. For this point, I do not think there is a necessity to change the current approach (i.e., give precedence to the value of the absolute form). |
Is there a recommendation we might make here? "If an intermediary uses the authority from a URI in the absolute form, it MUST erase any Host header field before forwarding the request." For instance. |
One reasonable solution could be to indicate that if an intermediary or server wants to use the authority from the URI, then it must use the host part from the Host header field. This at least enforces the use of the most controlled field which is expected to have been checked, de-duplicated, possibly matched against SNI etc. This would clarify the role of the Host header field in the request. |
Also I think that one reason for the ambiguity is that we all have to support HTTP/1.0 requests and make decisions when writing the code. As such we all implement fallbacks and default behaviours which tend to be the same between versions, and that's where we should probably indicate what to do depending on the version in the request. For example :
|
@wtarreau My understanding is that RFC 7230; section 5.4 instructs a proxy to use the value found in the absolute-form rather than the value of the host header field, regardless of the HTTP version being specified by the client. I think we should keep that as-is. Orthogonal to that, I think it's a good idea to clarify what a proxy should do (as @martinthomson suggests), and/or to allow a server to reject requests that carry contradicting values (between the authority of the absolute form and the value of the host header field). |
in the current draft we have:
... which seems to cover proxies. Non-proxy intermediaries can of course do what they like with Host (and often do). This doesn't give any advice to origin servers about which one to prefer when it is received, however. We could add something like:
Thoughts? |
7230 5.4 says:
However, the requirements upon a server receiving a request with a mismatching authority component and Host header are not clearly stated.
Below, it says:
However, a mismatching field-value is not clearly labeled to be invalid.
The waters are further muddied by 7230 section 5.5:
... which I've seen people interpret as "the absolute form takes precedence over the Host header."
I think we need to:
The text was updated successfully, but these errors were encountered: