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

Cannot get Matchers to mux h2c gRPC and HTTP2(REST) requests #78

Open
Liu-Chunhui opened this issue Aug 1, 2020 · 4 comments
Open

Cannot get Matchers to mux h2c gRPC and HTTP2(REST) requests #78

Liu-Chunhui opened this issue Aug 1, 2020 · 4 comments

Comments

@Liu-Chunhui
Copy link

Hi there,

Situration: my project is running in istio + k8s. When the http1.1 requests comes into the istio, it will be upgraded to http2 and passed to k8s pod. Also, I need to run non-tls gRPC and HTTP server on the same port, e.g. :9000

Issue: I try to use cmux to create machers to split grpc and rest requests but i am failed.

Could you please provide an example to achieve that?

Thanks,

@drunkpig
Copy link

see my explain #79

@howardjohn
Copy link

I think the issue you will find here is that your gRPC requests and HTTP2 requests are likely multiplexed over the same connection. cmux does matching at the connection level, so you end up with detecting one way or the other based on the first request, then all future requests are locked to whatever was originally matched.

@letian0805
Copy link

You can use cmux.HTTP2MatchHeaderFieldSendSettings("content-type, "application/grpc") match gRPC first, and then use cmux.Any match other proto and create new listener for new cmux.CMux

@BRUHItsABunny
Copy link

I was unable to get it to work with cmux, h2 REST would always fail to connect

I ended up following a similar approach to this:
https://ahmet.im/blog/grpc-http-mux-go/
For my use case this ended up working (http1.1, h2 REST and grpc all work as expected)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants