make reverse proxy insecure ssl (for influxdb)

This commit is contained in:
Qiu Jian
2018-11-03 10:01:06 +08:00
parent 5a6b4832ea
commit 732243efba
+4
View File
@@ -9,6 +9,7 @@ import (
"yunion.io/x/log"
"yunion.io/x/onecloud/pkg/httperrors"
"crypto/tls"
)
type EndpointGenerator func(context.Context, http.ResponseWriter, *http.Request) (string, error)
@@ -48,6 +49,9 @@ func (p *SReverseProxy) ServeHTTP(ctx context.Context, w http.ResponseWriter, r
}
log.Debugf("Forwarding to servie: %q, url: %q", p.serviceName, remoteUrl.String())
proxy := httputil.NewSingleHostReverseProxy(remoteUrl)
proxy.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
r.Header.Del("Cookie")
r.Header.Del("X-Auth-Token")
proxy.ServeHTTP(w, r)