gRPC HTTP/1.1 bridge
This filter should be configured with the type URL
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
If so, when the response is received, the filter buffers it and waits for trailers and then checks the
grpc-statuscode. If it is not zero, the filter switches the HTTP response code to 503. It also copies the
grpc-messagetrailers 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:
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-statustrailer 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.
Note that statistics should be collected by the dedicated gRPC stats filter instead. The use of this filter for gRPC telemetry has been disabled.
Protobuf upgrade support
The filter will automatically frame requests with content-type
application/x-protobuf as gRPC requests if
upgrade_protobuf_to_grpc is set.
In this case the filter will prepend the body with the gRPC frame described above, and update the content-type header to
application/grpc before sending the request to the gRPC server.
In case the client sends a
content-length header it will be removed before proceeding, as the value may conflict with
the size specified in the gRPC frame.
The response body returned to the client will not contain the gRPC header frame for requests that are upgraded in this fashion, i.e. the body will contain only the encoded Protobuf.
The filter emits statistics in the
cluster.<route target cluster>.grpc. namespace.
<grpc service>.<grpc method>.success
Total successful service/method calls
<grpc service>.<grpc method>.failure
Total failed service/method calls
<grpc service>.<grpc method>.total
Total service/method calls