-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Graceful handling of empty :authority header #5944
Comments
Did you debug where this is happening? I don't see any obvious check along these lines here: https://github.com/nghttp2/nghttp2/blob/master/lib/nghttp2_http.c which is where nghttp2 does its section 8 checks.
Personally I wouldn't bother unless someone asks for it, but we should probably at least send a 400 or 404 or whatever we do when its not present in an HTTP/1 request. But either way first we would need to get nghttp2 to not reject it. |
I think it's happening https://github.com/nghttp2/nghttp2/blob/d93842db3eb481fc6953ec70a81ed2f7863ffb45/lib/nghttp2_http.c#L90. We might want this feature to ensure we provide compatible semantics between Envoy and non-Envoy proxies. |
@PiotrSikora as our spec expert :-) We have a default host for HTTP/1.0 where it's explicitly allowed. I think we reject empty-but-present hosts for 1.1 and I have no idea if it's even allowed for 2.0 but I bet Piotr does! Also if empty authority is spec-legal I suspect we'd need an nghttp2 fix_update before we can do anything useful in Envoy |
FWIW we use default host for all versions of HTTP in-google (because existing behavior is hard to change) and I'd frankly love a configurable option to continue flouting the spec to not cause customers major pain as they adopt Envoy. :-D |
If it's hitting this, you aren't sending an empty header, the value must only be LWS, right?
If I read the code it is allowed, it just can't start with LWS. That's from a quick skim. |
The |
Ah I see. Yes. Yeah I have no idea about the spec on this one. |
@tatsuhiro-t would you be able to weigh in on how |
I believe this is where it gets rejected by nghttp2, though I didn't verify it. Per RFC7540, sec. 8.1.2.3, a missing
...but the "origin-form" doesn't apply to proxies (so it's illegal in Envoy, at least in theory), and the "asterisk-form" applies only to I don't believe that an empty What's the "legitimate" request that has an empty |
@PiotrSikora it's custom prober code. The point is that we (Google) need to maintain strict compatibility between our Envoy and non-Envoy edge proxies, including corner case behavior like this. I don't see where an empty |
Sorry, got confused by the "origin-form" for a second, per RFC7230, sec. 5.3.1, "origin-form" should still include the
though it could be empty, per sec. 5.4:
So it seems that it's an empty |
@htuch per RFC7540, sec. 8.1.2.3:
The "authority" is defined in RFC3986, sec. 3.2 as:
which with the HTTP/2 clause about deprecated "userinfo" becomes:
"host" is further defined in sec. 3.2.2 as:
and an empty value is declared as invalid for the "http" scheme:
I'm not sure if there is more authoritative document for that. |
I don't see any reason why empty :authority header field should be allowed. It seems that HTTP/2 specification only requires :authority header field if it is not empty. Does any browser send empty :authority header field? Or some intermediaries failed to produce proper HTTP/2 header field from HTTP/1.x request? |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions. |
Today, when nghttp2 observes an empty
:authority
, it rejects the HEADERS frame and resets the stream. It seems this is problematic, since it seems legitimate to have an empty:authority
, similar to an emptyhost
, see https://tools.ietf.org/html/rfc7230#section-5.4.Should we have a default authority configurable for HCM that is used when
:authority
is empty? My inclination is to add this.When a default authority is not configured, should we have Envoy do something sensible (pick default virtual host, pick first virtual host, etc.) or continue to reject the stream? I don't have a strong feeling on this one.
For context, we've seen this situation arise in one of our integration test probers.
The text was updated successfully, but these errors were encountered: