Description
Describe the bug
A clear and concise description of what the bug is.
http2: server: error reading preface from client 192.168.3.1:48056: bogus greeting "GET /uploadSocket HTTP/1"
The error of the client is either
2020/06/10 21:04:03 dial:malformed HTTP response "\x00\x00\x18\x04\x00\x00\x00\x00\x00\x00\x05\x00\x10\x00\x00\x00\x03\x00\x00\x00\xfa\x00\x06\x00\x10\x01@\x00\x04\x00\x10\x00\x00"
or EOF
My Go http server throws that error when connecting with gorilla websocket client,
this exact code used to work.
Clientside
I add custom root CAs and set them to the default http transport and gorillas default dialer.
tlscfg := tls.Config{InsecureSkipVerify: false, RootCAs: rootCAs}
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tlscfg
websocket.DefaultDialer.TLSClientConfig = &tlscfg
u := url.URL{Scheme: "wss", Host: ServerIP, Path:UploadSocket}
conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
if err != nil {
log.Fatal("dial:", err)
}
defer conn.Close()
This is fixed if i force the server to only use http 1, however that breaks other things.
Versions
Go version:go version go1.14.4 linux/amd64
package version: b65e629