-
Notifications
You must be signed in to change notification settings - Fork 281
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
disable http/2 for websockets #2399
Conversation
Code Climate has analyzed commit 101c29c and detected 0 issues on this pull request. View more on Code Climate. |
I tried that; it did not fix my test using streamlit.io as websocket server
|
It works for me. Can you provide concrete feedback. Or should I just close this PR too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your test environment is different, and yes this PR fixes it for that case.
the reason my configuration still does not work is different, I'll file a separate ticket about it.
@@ -211,6 +227,16 @@ func (b *Builder) buildPolicyTransportSocket( | |||
return nil, err | |||
} | |||
|
|||
var alpn []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we abstract out into a little sub function?
for _, e := range endpoints { | ||
if e.transportSocket != nil { | ||
tlsCount++ | ||
case upstreamProtocolAuto: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some contextualizing comments to this case? The fallthrough and empty default is uncommon enough where I'm not sure what it does without searching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are already comments. I don't know what else to add. I will remove the default case.
upstreamProtocol := upstreamProtocolAuto | ||
if policy.AllowWebsockets { | ||
// #2388, force http/1 when using web sockets | ||
upstreamProtocol = upstreamProtocolHTTP1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a log message to make clear we are using HTTP1 on this policy because websockets was set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To that point, I think we could abstract this little loop into a small function and call it directly in buildPolicyEndpoints
and buildCluster
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be very noisy, but ok.
@@ -201,6 +216,7 @@ func (b *Builder) buildPolicyTransportSocket( | |||
options *config.Options, | |||
policy *config.Policy, | |||
dst url.URL, | |||
upstreamProtocol upstreamProtocolConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having an additional function argument for upstreamProtocol here feels weird to me since we already have the info we need in policy *config.Policy
to determine the upstreamProtocol.
Welp, guess I missed the bus on this PR. 😆 edit: I think the code is fine, but would prefer not to keep adding to the list of function arguments if the information we need ( |
Summary
I guess you can't use http/2 with websockets because they use the same header field. This PR updates the envoy config to explicitly disable http/2 when using web sockets.
Related issues
Checklist
improvement
/bug
/ etc)