gRPC-JSON transcoder
This filter should be configured with the name envoy.filters.http.grpc_json_transcoder.
This is a filter which allows a RESTful JSON API client to send requests to Envoy over HTTP and get proxied to a gRPC service. The HTTP mapping for the gRPC service has to be defined by .
Envoy has to know the proto descriptor of your gRPC service in order to do the transcoding.
To generate a protobuf descriptor set for the gRPC service, you’ll also need to clone the googleapis repository from GitHub before running protoc, as you’ll need annotations.proto in your include path, to define the HTTP mapping.
Then run protoc to generate the descriptor set from bookstore.proto:
The route configs to be used with the gRPC-JSON transcoder should be identical to the gRPC route. The requests processed by the transcoder filter will have /<package>.<service>/<method> path and POST method. The route configs for those requests should match on /<package>.<service>/<method>, not the incoming request path. This allows the routes to be used for both gRPC requests and gRPC-JSON transcoded requests.
For example, with the following proto example, the router will process /helloworld.Greeter/SayHello as the path, so the route config prefix /say won’t match requests to SayHello. If you want to match the incoming request path, set match_incoming_request_route to true.
By default, when transcoding occurs, gRPC-JSON encodes the message output of a gRPC service method into JSON and sets the HTTP response Content-Type header to application/json. To send arbitrary content, a gRPC service method can use google.api.HttpBody as its output message type. The implementation needs to set (which sets the value of the HTTP response Content-Type header) and data (which sets the HTTP response body) accordingly.