Open aus opened 5 years ago
Fix this issue by adding a ProxyConnectHeader to Dialer and use this header connecting through a proxy.
Untill this feature gets properly implemented into the main branch, you can use my version. https://github.com/fenny/websocket
dialer := websocket.Dialer{
Proxy: http.ProxyURL(&url.URL{
Scheme: "http",
Host: "127.0.0.1:6969",
Path: "/",
}),
ProxyConnectHeaders: map[string]string{
"Proxy-Auth": "user:pass",
"Proxy-Geo": "EU",
},
}
When an HTTP proxy is used, there is no way to customize the headers in the initial CONNECT request. In some situations, a HTTP proxy may require certain User-Agents or other headers. golang added support for this in
net/http
in 1.8. The golang issue is documented here with support added in 1.8 as documented here.Note, this is not the same as providing a
requestHeader
toConn.NewClient
orDialer.Dial
. These headers are only present after the initial CONNECT request to the HTTP proxy.