From d3c305c4ff46a1ae32df9cbcce2f389b668aa4d2 Mon Sep 17 00:00:00 2001 From: Alexander Matyushentsev Date: Sat, 12 Feb 2022 14:25:52 -0800 Subject: [PATCH] fix: add workaround to fix 'stream terminated by RST_STREAM with error code: PROTOCOL_ERROR' (#1862) Signed-off-by: Alexander Matyushentsev --- server/server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/server.go b/server/server.go index bc9661c5b5..393cc97a08 100644 --- a/server/server.go +++ b/server/server.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "os" + "strings" "time" "github.com/argoproj/pkg/errors" @@ -101,7 +102,11 @@ func (s *ArgoRolloutsServer) newHTTPServer(ctx context.Context, port int) *http. gwMuxOpts := runtime.WithMarshalerOption(runtime.MIMEWildcard, new(json.JSONMarshaler)) gwmux := runtime.NewServeMux(gwMuxOpts, - runtime.WithIncomingHeaderMatcher(func(key string) (string, bool) { return key, true }), + runtime.WithIncomingHeaderMatcher(func(key string) (string, bool) { + // Dropping "Connection" header as a workaround for https://github.com/grpc-ecosystem/grpc-gateway/issues/2447 + // The fix is part of grpc-gateway v2.x but not available in v1.x, so workaround should be removed after upgrading to grpc v2.x + return key, strings.ToLower(key) != "connection" + }), runtime.WithProtoErrorHandler(runtime.DefaultHTTPProtoErrorHandler), )