Skip to content

Commit

Permalink
fix: Allow mTLS to work over gRPC using cmux. (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
vchudnov-g authored Jun 16, 2021
1 parent 9368968 commit 32c8d03
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/gapic-showcase/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ func CreateAllEndpoints(config RuntimeConfig) Endpoint {
stdLog.Printf("Showcase listening on port: %s", config.port)

m := cmux.New(lis)
grpcListener := m.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
httpListener := m.Match(cmux.HTTP1Fast())
// cmux.Any() is needed below to get mTLS to work for
// gRPC, and that in turn means the order of the matchers matters. See
// https://github.com/open-telemetry/opentelemetry-collector/issues/2732
grpcListener := m.Match(cmux.Any())

backend := createBackends()
gRPCServer := newEndpointGRPC(grpcListener, config, backend)
Expand Down

0 comments on commit 32c8d03

Please sign in to comment.