soheilhy/cmux

How do I serve SSL for both GRPC and HTTPS service?

tamalsaha opened this issue · 5 comments

Hi,
Thanks for this library. I am trying to serve GRPC and GRPC-gateway(only https) on the same port and terminate SSL for both at the go server. Do you mind showing example on how to do that? Here is a code example of what I am trying to do:
https://github.com/appscode/appstream/blob/master/cmd/appstream/app/server.go#L48

Thanks.

An option, that I can think of, is to match grpc first and send all that's maching to your grpc listener:
https://github.com/soheilhy/cmux/blob/master/example_test.go#L115
The rest should unconditionally be sent to the gateway.

@soheilhy, thanks for answering. How do you use SSL with gRPC in that scenario?

@soheilhy I think I understand how to handle TLS with gRPC services. Thanks.

can you share info @tamalsaha ?

@vtolstov , here is an example grpc server using this library https://github.com/appscode/hello-grpc