Title: Is there a way to expose a gRPC service as only HTTP and not as a gRPC service.
Description:
I'm writing a gRPC service which I want to expose only as HTTP service for now, maybe in future I might need to expose it as both HTTP and gRPC service but for now only as a HTTP service.
Considering the following Config file, how should I expose Bookstore service only as HTTP and not as gRPC.
Config:
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 10000 }
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
# coupled with the outgoing request
- match: { prefix: "/bookstore.Bookstore/ListShelves" }
route: { cluster: grpc_service }
http_filters:
- name: envoy.grpc_json_transcoder
config:
proto_descriptor: ./proto.pb
services: [bookstore.Bookstore]
Many Thanks,
Sidhu
@lps0535 after https://github.com/envoyproxy/envoy/pull/2848 is merged, you will be able to do this.
instead of adding a route for /bookstore.Bookstore/ListShelves, you'll instead add a route that matches the route specified in your proto file (in this case, /shelves)
You can define your route with a HeaderMatcher to match "x-envoy-original-path" header. All transcoded request has this attached but native gRPC requests don't.
Closing as answered.