From 98bfa4197850909a36868432fe8439f12951275f Mon Sep 17 00:00:00 2001 From: Rajat Vig Date: Sun, 12 Jan 2025 00:59:13 +0000 Subject: [PATCH 1/3] Allow connect on Http2ProtocolOptions when Websockets are enabled Signed-off-by: Rajat Vig --- changelogs/unreleased/6846-rvig-small.md | 1 + internal/envoy/v3/listener.go | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelogs/unreleased/6846-rvig-small.md diff --git a/changelogs/unreleased/6846-rvig-small.md b/changelogs/unreleased/6846-rvig-small.md new file mode 100644 index 00000000000..05bc7628eae --- /dev/null +++ b/changelogs/unreleased/6846-rvig-small.md @@ -0,0 +1 @@ +Set `allow_connect` to true on `Http2ProtocolOptions` on the Listener when websockets are enabled. diff --git a/internal/envoy/v3/listener.go b/internal/envoy/v3/listener.go index 213a71af9bf..b1ef7ecfd02 100644 --- a/internal/envoy/v3/listener.go +++ b/internal/envoy/v3/listener.go @@ -568,6 +568,7 @@ func (b *httpConnectionManagerBuilder) Get() *envoy_config_listener_v3.Filter { UpgradeType: "websocket", }, ) + cm.Http2ProtocolOptions.AllowConnect = true } return &envoy_config_listener_v3.Filter{ From 337b24ae2b109731bce3a2e7d6a8184bf45f6659 Mon Sep 17 00:00:00 2001 From: Rajat Vig Date: Sun, 12 Jan 2025 01:04:06 +0000 Subject: [PATCH 2/3] Fix release note Signed-off-by: Rajat Vig --- .../unreleased/{6846-rvig-small.md => 6846-rajatvig-small.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelogs/unreleased/{6846-rvig-small.md => 6846-rajatvig-small.md} (100%) diff --git a/changelogs/unreleased/6846-rvig-small.md b/changelogs/unreleased/6846-rajatvig-small.md similarity index 100% rename from changelogs/unreleased/6846-rvig-small.md rename to changelogs/unreleased/6846-rajatvig-small.md From 0da4d80b01d7b026858ea0cb907cd639fe8bcaa0 Mon Sep 17 00:00:00 2001 From: Rajat Vig Date: Sun, 12 Jan 2025 01:20:21 +0000 Subject: [PATCH 3/3] Fix code logic Signed-off-by: Rajat Vig --- internal/envoy/v3/listener.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/internal/envoy/v3/listener.go b/internal/envoy/v3/listener.go index b1ef7ecfd02..29dfaab9e08 100644 --- a/internal/envoy/v3/listener.go +++ b/internal/envoy/v3/listener.go @@ -556,10 +556,10 @@ func (b *httpConnectionManagerBuilder) Get() *envoy_config_listener_v3.Filter { cm.CommonHttpProtocolOptions.MaxRequestsPerConnection = wrapperspb.UInt32(*b.maxRequestsPerConnection) } + http2Options := &envoy_config_core_v3.Http2ProtocolOptions{} + if b.http2MaxConcurrentStreams != nil { - cm.Http2ProtocolOptions = &envoy_config_core_v3.Http2ProtocolOptions{ - MaxConcurrentStreams: wrapperspb.UInt32(*b.http2MaxConcurrentStreams), - } + http2Options.MaxConcurrentStreams = wrapperspb.UInt32(*b.http2MaxConcurrentStreams) } if b.enableWebsockets { @@ -568,7 +568,12 @@ func (b *httpConnectionManagerBuilder) Get() *envoy_config_listener_v3.Filter { UpgradeType: "websocket", }, ) - cm.Http2ProtocolOptions.AllowConnect = true + http2Options.AllowConnect = true + } + + // Assign http2Options only if it has been modified + if b.http2MaxConcurrentStreams != nil { + cm.Http2ProtocolOptions = http2Options } return &envoy_config_listener_v3.Filter{