.. _config_http_filters_grpc_json_transcoder: gRPC-JSON transcoder ==================== * gRPC :ref:`architecture overview ` * :ref:`v1 API reference ` * :ref:`v2 API reference ` 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 `custom options `_. .. _config_grpc_json_generate_proto_descriptor_set: How to generate proto descriptor set ------------------------------------ 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. .. code-block:: bash git clone https://github.com/googleapis/googleapis GOOGLEAPIS_DIR= Then run protoc to generate the descriptor set from bookstore.proto: .. code-block:: bash protoc -I$(GOOGLEAPIS_DIR) -I. --include_imports --include_source_info \ --descriptor_set_out=proto.pb test/proto/bookstore.proto If you have more than one proto source files, you can pass all of them in one command. Route configs for transcoded requests ------------------------------------- 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 `/./` path and `POST` method. The route configs for those requests should match on `/./`, 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. .. code-block:: proto package helloworld; // The greeting service definition. service Greeter { // Sends a greeting rpc SayHello (HelloRequest) returns (HelloReply) { option (google.api.http) = { get: "/say" }; } }