Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to expose a gRPC service as only HTTP and not as a gRPC service? #2991

Closed
lps0535 opened this issue Apr 4, 2018 · 3 comments
Labels
question Questions that are neither investigations, bugs, nor enhancements

Comments

@lps0535
Copy link

lps0535 commented Apr 4, 2018

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

@mattklein123 mattklein123 added the question Questions that are neither investigations, bugs, nor enhancements label Apr 4, 2018
@ilackarms
Copy link
Contributor

@lps0535 after #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)

@lizan
Copy link
Member

lizan commented Apr 4, 2018

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.

@mattklein123
Copy link
Member

Closing as answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions that are neither investigations, bugs, nor enhancements
Projects
None yet
Development

No branches or pull requests

4 participants