This commit is contained in:
eson 2023-08-21 15:27:24 +08:00
parent 787bc76868
commit 71fa126480

View File

@ -150,18 +150,10 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac
},
}
dialer := &websocket.Dialer{
Proxy: http.ProxyFromEnvironment,
NetDial: func(network, addr string) (net.Conn, error) {
return net.Dial(network, addr)
},
}
// 创建后端服务对象,包含地址和客户端
backend := &Backend{
HttpAddress: httpAddress,
Client: client,
Dialer: dialer,
}
// 创建处理请求的函数
@ -198,6 +190,7 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac
header.Del("Sec-Websocket-Key")
header.Del("Sec-Websocket-Version")
header.Del("Connection")
// header.Del("Origin")
proxyConn, _, err := backend.Dialer.Dial(target.String(), header)
if err != nil {