|
@@ -85,11 +85,8 @@ func (m *Manager) HandleHttpByInstanceId(instanceId string, w http.ResponseWrite
|
|
|
if r.Header["Upgrade"] != nil && strings.ToLower(r.Header["Upgrade"][0]) == "websocket" {
|
|
|
//Handle WebSocket request. Forward the custom Upgrade header and rewrite origin
|
|
|
r.Header.Set("A-Upgrade", "websocket")
|
|
|
- if len(requestURL) > 0 && requestURL[:1] == "/" {
|
|
|
- //Remove starting / from request URL if exists
|
|
|
- requestURL = requestURL[1:]
|
|
|
- }
|
|
|
- u, _ := url.Parse("ws://127.0.0.1:" + strconv.Itoa(targetInstance.AssignedPort) + requestURL)
|
|
|
+ requestURL = strings.TrimPrefix(requestURL, "/")
|
|
|
+ u, _ := url.Parse("ws://127.0.0.1:" + strconv.Itoa(targetInstance.AssignedPort) + "/" + requestURL)
|
|
|
wspHandler := websocketproxy.NewProxy(u)
|
|
|
wspHandler.ServeHTTP(w, r)
|
|
|
return
|
|
@@ -157,9 +154,9 @@ func (i *Instance) CreateNewConnection(listenPort int, remoteIpAddr string, remo
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- //Create a new proxy object to the proxy
|
|
|
+ //Create new proxy objects to the proxy
|
|
|
proxy := reverseproxy.NewReverseProxy(path)
|
|
|
- i.conn = proxy
|
|
|
|
|
|
+ i.conn = proxy
|
|
|
return nil
|
|
|
}
|