11package ui
22
33import (
4- "crypto/tls"
54 "io"
65 "io/ioutil"
76 "net/http"
@@ -13,17 +12,6 @@ import (
1312 "github.com/sirupsen/logrus"
1413)
1514
16- var (
17- insecureClient = & http.Client {
18- Transport : & http.Transport {
19- Proxy : http .ProxyFromEnvironment ,
20- TLSClientConfig : & tls.Config {
21- InsecureSkipVerify : true ,
22- },
23- },
24- }
25- )
26-
2715const (
2816 defaultPath = "./ui"
2917)
@@ -158,15 +146,23 @@ func (u *Handler) IndexFileOnNotFound() http.Handler {
158146func (u * Handler ) IndexFile () http.Handler {
159147 return u .indexMiddleware (http .HandlerFunc (func (rw http.ResponseWriter , req * http.Request ) {
160148 if path , isURL := u .path (); isURL {
161- _ = serveIndex (rw , path )
149+ err := serveIndex (rw , path )
150+ if err != nil {
151+ logrus .Errorf ("failed to download %s: %v" , path , err )
152+ }
162153 } else {
163154 http .ServeFile (rw , req , filepath .Join (path , "index.html" ))
164155 }
165156 }))
166157}
167158
168159func serveIndex (resp io.Writer , url string ) error {
169- r , err := insecureClient .Get (url )
160+ client := & http.Client {
161+ Transport : & http.Transport {
162+ Proxy : http .ProxyFromEnvironment ,
163+ },
164+ }
165+ r , err := client .Get (url )
170166 if err != nil {
171167 return err
172168 }
0 commit comments