1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 01:57:32 +08:00

Remove unnecesary proxy

This commit is contained in:
Marcos Lilljedahl 2017-03-30 18:50:10 -03:00
parent 75f3c93612
commit c4be25076d

View File

@ -1,32 +0,0 @@
package handlers
import (
"crypto/tls"
"fmt"
"net/http"
"github.com/gorilla/mux"
"github.com/yhat/wsutil"
)
func NewMultipleHostWebsocketReverseProxy() *wsutil.ReverseProxy {
tlsConfig := &tls.Config{
InsecureSkipVerify: true,
}
director := func(req *http.Request) {
v := mux.Vars(req)
node, port := getTargetInfo(v, req)
if port == "443" {
// Only proxy http for now
req.URL.Scheme = "wss"
} else {
// Only proxy http for now
req.URL.Scheme = "ws"
}
req.URL.Host = fmt.Sprintf("%s:%s", node, port)
}
return &wsutil.ReverseProxy{Director: director, TLSClientConfig: tlsConfig}
}