fix tls in proxy func

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux 2015-01-13 22:02:09 +00:00
parent cccbd0baea
commit 0885c7b5b8
1 changed files with 3 additions and 5 deletions

View File

@ -45,14 +45,12 @@ func proxy(tlsConfig *tls.Config, container *cluster.Container, w http.ResponseW
// RequestURI may not be sent to client // RequestURI may not be sent to client
r.RequestURI = "" r.RequestURI = ""
parts := strings.SplitN(container.Node.Addr, "://", 2) if tlsConfig != nil {
if len(parts) == 2 { r.URL.Scheme = "https"
r.URL.Scheme = parts[0]
r.URL.Host = parts[1]
} else { } else {
r.URL.Scheme = "http" r.URL.Scheme = "http"
r.URL.Host = parts[0]
} }
r.URL.Host = container.Node.Addr
log.Debugf("[PROXY] --> %s %s", r.Method, r.URL) log.Debugf("[PROXY] --> %s %s", r.Method, r.URL)
resp, err := client.Do(r) resp, err := client.Do(r)