diff --git a/pkg/ui/handler.go b/pkg/ui/handler.go index 69c562c8..38bf2d55 100644 --- a/pkg/ui/handler.go +++ b/pkg/ui/handler.go @@ -1,7 +1,6 @@ package ui import ( - "crypto/tls" "io" "io/ioutil" "net/http" @@ -13,17 +12,6 @@ import ( "github.com/sirupsen/logrus" ) -var ( - insecureClient = &http.Client{ - Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - }, - }, - } -) - const ( defaultPath = "./ui" ) @@ -158,7 +146,10 @@ func (u *Handler) IndexFileOnNotFound() http.Handler { func (u *Handler) IndexFile() http.Handler { return u.indexMiddleware(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { if path, isURL := u.path(); isURL { - _ = serveIndex(rw, path) + err := serveIndex(rw, path) + if err != nil { + logrus.Errorf("failed to download %s: %v", path, err) + } } else { http.ServeFile(rw, req, filepath.Join(path, "index.html")) } @@ -166,7 +157,12 @@ func (u *Handler) IndexFile() http.Handler { } func serveIndex(resp io.Writer, url string) error { - r, err := insecureClient.Get(url) + client := &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + }, + } + r, err := client.Get(url) if err != nil { return err }