From a5af9e19351d1734c3686b2484c6a557b31f7af1 Mon Sep 17 00:00:00 2001 From: Martin Turoci Date: Thu, 28 Nov 2024 13:33:50 +0100 Subject: [PATCH] fix: Turn off TLS verification before every other http calls so that it covers everything. Closes #2323 --- server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.go b/server.go index 924262815d..478095e354 100644 --- a/server.go +++ b/server.go @@ -79,6 +79,10 @@ func Run(conf ServerConf) { isTLS := conf.CertFile != "" && conf.KeyFile != "" + if conf.SkipCertVerification { + http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} + } + printLaunchBar(conf.Listen, conf.BaseURL, isTLS) site := newSite() @@ -149,10 +153,6 @@ func Run(conf ServerConf) { echo(Log{"t": "listen", "address": conf.Listen, "web-dir": conf.WebDir, "base-url": conf.BaseURL}) - if conf.SkipCertVerification { - http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} - } - if isTLS { if err := http.ListenAndServeTLS(conf.Listen, conf.CertFile, conf.KeyFile, nil); err != nil { echo(Log{"t": "listen_tls", "error": err.Error()})