gRPC HTTP/1.1 bridge

This is a simple filter which enables the bridging of an HTTP/1.1 client which does not support response trailers to a compliant gRPC server. It works by doing the following:

  • When a request is sent, the filter sees if the connection is HTTP/1.1 and the request content type is application/grpc.

  • If so, when the response is received, the filter buffers it and waits for trailers and then checks the grpc-status code. If it is not zero, the filter switches the HTTP response code to 503. It also copies the grpc-status and grpc-message trailers into the response headers so that the client can look at them if it wishes.

  • The client should send HTTP/1.1 requests that translate to the following pseudo headers:

    • :method: POST

    • :path: <gRPC-METHOD-NAME>

    • content-type: application/grpc

  • The body should be the serialized grpc body which is:

    • 1 byte of zero (not compressed).

    • network order 4 bytes of proto message length.

    • serialized proto message.

  • Because this scheme must buffer the response to look for the grpc-status trailer it will only work with unary gRPC APIs.

This filter also collects stats for all gRPC requests that transit, even if those requests are normal gRPC requests over HTTP/2 or above.

More info: wire format in gRPC over HTTP/2.

Attention

Note that statistics should be collected by the dedicated gRPC stats filter instead. The use of this filter for gRPC telemetry has been disabled. Set the runtime value of envoy.reloadable_features.grpc_bridge_stats_disabled to false to turn on stat collection.

Statistics

The filter emits statistics in the cluster.<route target cluster>.grpc. namespace.

Name

Type

Description

<grpc service>.<grpc method>.success

Counter

Total successful service/method calls

<grpc service>.<grpc method>.failure

Counter

Total failed service/method calls

<grpc service>.<grpc method>.total

Counter

Total service/method calls