Enable HTTP/2 in grpc service (#4842)

Signed-off-by: Johnny Bergström <johnny@klaudify.se>
This commit is contained in:
Johnny Bergström
2021-10-08 15:56:33 +02:00
committed by GitHub
parent d95a82350b
commit 9af2dc11f9

View File

@@ -40,6 +40,11 @@ func NewServergRPC(addr string, group []*Config) (*ServergRPC, error) {
// Should we error if some configs *don't* have TLS? // Should we error if some configs *don't* have TLS?
tlsConfig = conf.TLSConfig tlsConfig = conf.TLSConfig
} }
// http/2 is required when using gRPC. We need to specify it in next protos
// or the upgrade won't happen.
if tlsConfig != nil {
tlsConfig.NextProtos = []string{"h2"}
}
return &ServergRPC{Server: s, tlsConfig: tlsConfig}, nil return &ServergRPC{Server: s, tlsConfig: tlsConfig}, nil
} }