Skip to content

Commit

Permalink
Falls back to SPDY for gorilla/websocket https proxy error
Browse files Browse the repository at this point in the history
Kubernetes-commit: 9d560540c5268e0e2aebf5306907494cf522c260
  • Loading branch information
seans3 authored and k8s-publishing-bot committed Jul 19, 2024
1 parent b4d17b8 commit 2c588bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pkg/cmd/attach/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ func createExecutor(url *url.URL, config *restclient.Config) (remotecommand.Exec
if err != nil {
return nil, err
}
exec, err = remotecommand.NewFallbackExecutor(websocketExec, exec, httpstream.IsUpgradeFailure)
exec, err = remotecommand.NewFallbackExecutor(websocketExec, exec, func(err error) bool {
return httpstream.IsUpgradeFailure(err) || httpstream.IsHTTPSProxyError(err)
})
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ func createExecutor(url *url.URL, config *restclient.Config) (remotecommand.Exec
if err != nil {
return nil, err
}
exec, err = remotecommand.NewFallbackExecutor(websocketExec, exec, httpstream.IsUpgradeFailure)
exec, err = remotecommand.NewFallbackExecutor(websocketExec, exec, func(err error) bool {
return httpstream.IsUpgradeFailure(err) || httpstream.IsHTTPSProxyError(err)
})
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/portforward/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ func createDialer(method string, url *url.URL, opts PortForwardOptions) (httpstr
return nil, err
}
// First attempt tunneling (websocket) dialer, then fallback to spdy dialer.
dialer = portforward.NewFallbackDialer(tunnelingDialer, dialer, httpstream.IsUpgradeFailure)
dialer = portforward.NewFallbackDialer(tunnelingDialer, dialer, func(err error) bool {
return httpstream.IsUpgradeFailure(err) || httpstream.IsHTTPSProxyError(err)
})
}
return dialer, nil
}
Expand Down

0 comments on commit 2c588bc

Please sign in to comment.