-
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
HTTP/1.1, chunked encoding and trailers #7149
Comments
Thanks @htuch |
@wlhee "trailers-only" is actually "headers-only" in term of HTTP/2, so that one can be transcoded to a normal HTTP/1.1 response without body. |
@htuch AFAIK, |
I see, this matches my observation. We want to transfer gRPC error message, which is a Trailers-only h2 response, over an intermediate HTTP/1.1 response. We can work around it for gRPC error message only. |
Is HTTP/1.1 codec used for h2->h1 transferring or h1->h1 transferring? |
This is correct. It would not be hard to implement HTTP/1.1 trailers, but I've never seen a real-world case in which this would be useful. re: H2 <-> H1 bridging, check out the filters defined here https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/grpc#grpc-bridging. They are implemented to help do bridging for gRPC to H1. |
Do you mean "it would not be hard to implement converting HTTP/2 trailers to HTTP/1.1 trailers"? This would be useful in our use case as we have another proxy in front of envoy: We need tell the proxy response trailers to help it reconstruct the HTTP/2 response to the client. |
@mattklein123 @lizan the specific use case that is interesting here to us is a multi-hop transcode: HTTP/2 <-> Proxy A <-> HTTP/1.1 <-> Proxy B <-> HTTP/2 Assume that proxy B is Envoy but proxy A is just a normal standards compliant H2 <-> H1 transcoding proxy with support for trailers, and you want to transcode H2 to H1 for the purpose of tunneling (those details are not material I think). I think this is where we're hitting the gap in existing support. It's not possible to use the reverse gRPC bridge at A. |
Correct, it would not be difficult. It just needs to be implemented in the codec to correctly deal with the chunked trailer. |
Something I don't quite understand: [2019-05-29 22:25:15.820][60332][debug][client] [third_party/envoy/src/source/common/http/codec_client.cc:95] [C1] response complete If the trailers conversion is missing, why would I see "encoding trailer" part? |
@wlhee it is the downstream codec (after HCM log) eating the trailers, so you still see them in HCM log. |
I see. But the weird thing is, when my upstream HTTP/1.1 server sends trailers, I did NOT see them in the HCM log: However, my server is actually sending trailers, the followings are response directly from curling the http/1.1 server:
< HTTP/1.1 200 OK 9 0
|
@wlhee that because the upstream HTTP/1.1 codec ate them, so they are not even hitting HCM. |
I see, to confirm my understanding:
|
@wlhee That's right. |
Closing as answered. |
We've had a number of internal questions about how Envoy handles trailers with chunked encoded HTTP/1.1 when transcoding back and forth between HTTP/2. I.e. how do HTTP/2 trailers get represented. Looking at the HTTP/1.1 codec implementation, it doesn't seem like it does anything useful with the trailers in
StreamEncoderImpl::encodeTrailers
.I'm thinking I'm missing something here, since I thought we had reasonably complete support for HTTP/1.1 chunked encoding, but this isn't my area really. @mattklein123 I assume you know the full story here :)
CC @wlhee
The text was updated successfully, but these errors were encountered: