Skip to content

Commit

Permalink
fix: Turn off TLS verification before every other http calls so that …
Browse files Browse the repository at this point in the history
…it covers everything. Closes #2323
  • Loading branch information
mturoci committed Nov 28, 2024
1 parent 24719bf commit a5af9e1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()})
Expand Down

0 comments on commit a5af9e1

Please sign in to comment.