Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always enforce HttpVersionPolicy on WebSocket version negotiation #2729

Merged
merged 4 commits into from
Feb 6, 2025

Conversation

MihaZupan
Copy link
Member

When we added HTTP/2 WebSocket support, the intention behind version selection was that we would match SocketsHttpHandler/ClientWebSocket behavior.

When the user specified Version=2.0, Policy=RequestVersionOrHigher, we should be attempting HTTP/2 WebSockets, regardless of whether the destination is using https or not.
Currently, we'll use HTTP/1.1 instead, which goes against the specified policy.
Aside from violating the configured policy, the current behavior is problematic when the backend service only supports HTTP/2. Instead of using H2 as requested, we'll downgrade the H1, and all requests will fail.

This change makes YARP strictly follow the version policy. If the user told us not to use HTTP/1.X, we simply shouldn't.
If the backend server happens to only support HTTP/1.X, then the request will fail, and that's a proxy misconfiguration.

@MihaZupan MihaZupan added this to the YARP 2.3 milestone Jan 28, 2025
@adityamandaleeka
Copy link
Member

@MihaZupan Can this be merged?

@MihaZupan
Copy link
Member Author

Yep, I'll add another test and merge it once CI is back up

@MihaZupan MihaZupan merged commit 41e563c into dotnet:main Feb 6, 2025
7 checks passed
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.

4 participants