-
Notifications
You must be signed in to change notification settings - Fork 331
Closed
Description
If the server responds with 302 https://test.com/ws the redirect works, but if the response is 302 wss://test.com/ws the redirect fails with failed to WebSocket dial: failed to send handshake request: Get "wss://test.com/ws": unsupported protocol scheme "wss"
I was able to fix the issue by specifying a custom http.Client in the DialOptions
HTTPClient: &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
switch req.URL.Scheme {
case "ws":
req.URL.Scheme = "http"
case "wss":
req.URL.Scheme = "https"
case "http", "https":
default:
return fmt.Errorf("unexpected url scheme: %q", req.URL.Scheme)
}
return nil
},
},Do you think this should be included in the default client? I would be happy to open a PR with the functionality,