Skip to content

Commit c21167e

Browse files
zeripathbminer6543
authored
Fix bound address/port for caddy's certmagic library (see #15848) (#15859) (#15878)
Co-authored-by: Blake Miner <[email protected]> Co-authored-by: 6543 <[email protected]>
1 parent aaa539d commit c21167e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/web_letsencrypt.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
2424
enableHTTPChallenge := true
2525
enableTLSALPNChallenge := true
2626
altHTTPPort := 0
27+
altTLSALPNPort := 0
2728

2829
if p, err := strconv.Atoi(setting.PortToRedirect); err == nil {
2930
altHTTPPort = p
3031
}
32+
if p, err := strconv.Atoi(setting.HTTPPort); err == nil {
33+
altTLSALPNPort = p
34+
}
3135

3236
magic := certmagic.NewDefault()
3337
magic.Storage = &certmagic.FileStorage{Path: directory}
@@ -36,7 +40,8 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
3640
Agreed: setting.LetsEncryptTOS,
3741
DisableHTTPChallenge: !enableHTTPChallenge,
3842
DisableTLSALPNChallenge: !enableTLSALPNChallenge,
39-
ListenHost: listenAddr,
43+
ListenHost: setting.HTTPAddr,
44+
AltTLSALPNPort: altTLSALPNPort,
4045
AltHTTPPort: altHTTPPort,
4146
})
4247

0 commit comments

Comments
 (0)