envoyproxy/envoy

grpc_http1_reverse_bridge filter: support text errors from upstream

Open

#12.953 aperta il 2 set 2020

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)C++ (5373 fork)batch import
area/grpchelp wanted

Metriche repository

Star
 (27.997 star)
Metriche merge PR
 (Merge medio 8g) (378 PR mergiate in 30 g)

Descrizione

Title: grpc_http1_reverse_bridge filter: support text errors from upstream

Description: Currently, the grpc_http1_reverse_bridge filter is configured with a single content_type that the upstream must respond with, or the filter stands in its own error (saying that the content type was wrong).

However, gRPC supports sending text error responses (see "Standard error model") here https://grpc.io/docs/guides/error/. This is exactly how the filter stands in its current error without needing to have knowledge of the response proto message.

It seems like it would make sense to allow configuring the filter to support passing text error message from the upstream to the downstream by using the grpc-message trailer as it currently does.

Proposal:

Add a pass_through_plaintext_errors bool to the filter's config. When set:

if upstream responds with anything other than 4xx or 5xx, and content type doesn't match the configured content-type, keep the behavior the same.

If the upstream responds with 4xx or 5xx, and the content type is something like text/plain, put it into grpc-message. (Note that i'm not knowledgeable about MIME types so probably that's not an exhaustive list of what should be included, and maybe the exact allowable types should be configurable as well).

Guida contributor