From 0885c7b5b88b4667123c197b346719f8ea570b77 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 13 Jan 2015 22:02:09 +0000 Subject: [PATCH] fix tls in proxy func Signed-off-by: Victor Vieux --- api/utils.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/api/utils.go b/api/utils.go index 0468af21af..88f5f79102 100644 --- a/api/utils.go +++ b/api/utils.go @@ -45,14 +45,12 @@ func proxy(tlsConfig *tls.Config, container *cluster.Container, w http.ResponseW // RequestURI may not be sent to client r.RequestURI = "" - parts := strings.SplitN(container.Node.Addr, "://", 2) - if len(parts) == 2 { - r.URL.Scheme = parts[0] - r.URL.Host = parts[1] + if tlsConfig != nil { + r.URL.Scheme = "https" } else { r.URL.Scheme = "http" - r.URL.Host = parts[0] } + r.URL.Host = container.Node.Addr log.Debugf("[PROXY] --> %s %s", r.Method, r.URL) resp, err := client.Do(r)