From c0bafc5f3b0d2a0368718b77e27526012e55e24a Mon Sep 17 00:00:00 2001 From: Marcos Lilljedahl Date: Wed, 1 Feb 2017 16:40:23 -0300 Subject: [PATCH] Allow to access insecure https exposed services through proxy --- handlers/reverseproxy.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/handlers/reverseproxy.go b/handlers/reverseproxy.go index 849fd5c..f15282a 100644 --- a/handlers/reverseproxy.go +++ b/handlers/reverseproxy.go @@ -1,6 +1,7 @@ package handlers import ( + "crypto/tls" "fmt" "net" "net/http" @@ -23,6 +24,7 @@ func NewMultipleHostReverseProxy() *httputil.ReverseProxy { IdleConnTimeout: 100 * time.Millisecond, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } director := func(req *http.Request) { v := mux.Vars(req) @@ -42,8 +44,13 @@ func NewMultipleHostReverseProxy() *httputil.ReverseProxy { } } - // Only proxy http for now - req.URL.Scheme = "http" + if port == "443" { + // Only proxy http for now + req.URL.Scheme = "https" + } else { + // Only proxy http for now + req.URL.Scheme = "http" + } req.URL.Host = fmt.Sprintf("%s:%s", node, port) }