envoyproxy / envoyproxy/envoy

grpc_http1_reverse_bridge filter: support text errors from upstream

Open
#12,953 2 comments 0 reactions 0 assignees View on GitHub
area/grpc help wanted
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 22h
Merged PRs (30d)
430

Description

*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).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.