Browse Source

proxy: determine scheme based on TLSClientConfig

Brian Waldon 11 years ago
parent
commit
73504dca41
1 changed files with 6 additions and 1 deletions
  1. 6 1
      proxy/proxy.go

+ 6 - 1
proxy/proxy.go

@@ -5,7 +5,12 @@ import (
 )
 )
 
 
 func NewHandler(t *http.Transport, addrs []string) (http.Handler, error) {
 func NewHandler(t *http.Transport, addrs []string) (http.Handler, error) {
-	d, err := newDirector("http", addrs)
+	scheme := "http"
+	if t.TLSClientConfig != nil {
+		scheme = "https"
+	}
+
+	d, err := newDirector(scheme, addrs)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}