Skip to content

fix: force HTTP1 for upstream connections for WS and WSS backends#8699

Open
zhaohuabing wants to merge 5 commits intoenvoyproxy:mainfrom
zhaohuabing:fix-8693
Open

fix: force HTTP1 for upstream connections for WS and WSS backends#8699
zhaohuabing wants to merge 5 commits intoenvoyproxy:mainfrom
zhaohuabing:fix-8693

Conversation

@zhaohuabing
Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing commented Apr 8, 2026

This PR forces forces HTTP/1.1 upstream connections instead of negotiating HTTP/2 for ws and wss Backend appProtocols. This change avoids compatibility issues with WebSocket backends that do not support RFC 8441 extended CONNECT.

Fixes: #8693

@zhaohuabing zhaohuabing requested a review from a team as a code owner April 8, 2026 10:34
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 8, 2026

Deploy Preview for cerulean-figolla-1f9435 canceled.

Name Link
🔨 Latest commit 42ea32c
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69e6daaef5c2c700086b1150

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 94.73684% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.42%. Comparing base (56cc3f7) to head (42ea32c).

Files with missing lines Patch % Lines
internal/ir/xds.go 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8699      +/-   ##
==========================================
- Coverage   74.43%   74.42%   -0.02%     
==========================================
  Files         245      245              
  Lines       38973    39007      +34     
==========================================
+ Hits        29010    29031      +21     
- Misses       7960     7972      +12     
- Partials     2003     2004       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhaohuabing zhaohuabing marked this pull request as ready for review April 8, 2026 11:04
@zhaohuabing zhaohuabing marked this pull request as draft April 8, 2026 11:12
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing marked this pull request as ready for review April 9, 2026 01:24
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
},
}
// If forceHTTP1UpstreamProtocol is set, force Envoy to use HTTP1 upstream regardless of other settings.
case forceHTTP1UpstreamProtocol:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we reuse requiresHTTP1Options ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can’t. forceHTTP1UpstreamProtocol takes precedence over requiresHTTP2Options, which in turn takes precedence over requiresHTTP1Options.

// influence transport socket specific settings
requiresAutoHTTPConfig := len(args.settings) > 0
requiresHTTP2Options := false
forceHTTP1UpstreamProtocol := false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of this, would it make sense to use AppProtocol of WS in xds layer and set requiresHTTP1Options for that case ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requiresHTTP1Options and forceHTTP1UpstreamProtocol have different meanings. forceHTTP1UpstreamProtocol takes precedence over requiresHTTP2Options, which in turn takes precedence over requiresHTTP1Options.

Copy link
Copy Markdown
Member Author

@zhaohuabing zhaohuabing Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be easier to read if requiresHTTP2Options was named hasHTTP2OrGRPCUpstream

		if ds.Protocol == ir.GRPC ||
			ds.Protocol == ir.HTTP2 {
			requiresHTTP2Options = true
		}

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing requested a review from a team April 21, 2026 02:03
@zhaohuabing
Copy link
Copy Markdown
Member Author

/retest

Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

@zhaohuabing zhaohuabing requested a review from a team April 22, 2026 03:58
Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to have per port support in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WSS -> WSS handling

2 participants