Skip to content

Commit

Permalink
Fix bound address/port for caddy's certmagic library (see #15848) (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
bminer committed May 14, 2021
1 parent df72cf6 commit e2f39c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/web_letsencrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
enableHTTPChallenge := true
enableTLSALPNChallenge := true
altHTTPPort := 0
altTLSALPNPort := 0

if p, err := strconv.Atoi(setting.PortToRedirect); err == nil {
altHTTPPort = p
}
if p, err := strconv.Atoi(setting.HTTPPort); err == nil {
altTLSALPNPort = p
}

magic := certmagic.NewDefault()
magic.Storage = &certmagic.FileStorage{Path: directory}
Expand All @@ -36,7 +40,8 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
Agreed: setting.LetsEncryptTOS,
DisableHTTPChallenge: !enableHTTPChallenge,
DisableTLSALPNChallenge: !enableTLSALPNChallenge,
ListenHost: listenAddr,
ListenHost: setting.HTTPAddr,
AltTLSALPNPort: altTLSALPNPort,
AltHTTPPort: altHTTPPort,
})

Expand Down

0 comments on commit e2f39c2

Please sign in to comment.