-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
grpc_json_transcoder and http/1.1 doesn't properly handle trailers #4240
Comments
Can you elaborate a bit more with examples? You shouldn't be stacking the |
Here is what I get with curl:
My envoy http filters are set up like this: http_filters:
- name: envoy.cors
- name: envoy.gzip
- name: envoy.grpc_json_transcoder
config:
proto_descriptor: /config/msg.protoset
services:
- grpc.health.v1.Health
- zvelo.msg.APIv1
- name: envoy.health_check
config:
headers:
name: :path
exact_match: /health
pass_through_mode: false
cluster_min_healthy_percentages:
zveloapi:
value: 100
- name: envoy.grpc_web
- name: envoy.router |
@joshuarubin thanks for the example, the curl output matches my expectation. What does your go http client is complaining about? the |
Those should be sent by upstream gRPC server, but I think we can trim them in JSON transcoder filter. |
This is the result of a Go client we use:
There is no way to catch or bypass this error in the Go client. Fortunately, we can fix the issue in this case by using the http/2 client. Still it is an issue that needs to be addressed. |
Anything I can do to speed this along? I'm happy to take a stab at a PR. This issue isn't affecting us in production yet, but very soon will be. |
@joshuarubin If you would like to write a PR I'm happy to review. It would be simple to add some code here to do:
Also add tests accordingly. |
the code itself is pretty simple, if I've done it properly (at the location you mentioned above): if (encoder_callbacks_->requestInfo().protocol() < Http::Protocol::Http2) {
response_headers_->remove(Http::LowerCaseString("trailer"));
} However, I don't have a clue how to go about testing this. I'm able to run the tests with bazel, but don't know enough about the framework to be much help yet. Any advice? |
Add trailer to response header here and test if it is removed? https://github.com/envoyproxy/envoy/blob/master/test/extensions/filters/http/grpc_json_transcoder/json_transcoder_filter_test.cc#L314 |
resolves envoyproxy#4240 Signed-off-by: Joshua Rubin <joshua@rubixconsulting.com>
…4359) When clients connect using http/1, Trailer headers are prohibited unless the transfer encoding is chunked, which it shouldn't be. Remove these headers in this case. Risk Level: Low Testing: Integration testing has been done to ensure that these headers are in fact removed. Docs Changes: N/A Release Notes: N/A Fixes: #4240 Signed-off-by: Joshua Rubin <joshua@rubixconsulting.com>
When a client connects to envoy using http/1.1 and the endpoint uses the
grpc_json_transcoder
, nothing is done with the response trailer headers. This is a violation of the http/1.1 spec so long as the transfer encoding isn't chunked (which it isn't in this case).I've tried stacking the
grpc_json_transcoder
with thegrpc_http1_bridge
(both before and after the transcoder) but that doesn't seem to work either.This is a significant issue with clients that use the Go http client as it returns an error (and the body is impossible to reach) if it sees the trailer headers over http/1.1.
The text was updated successfully, but these errors were encountered: