]> source.dussan.org Git - gitea.git/commitdiff
Fix bound address/port for caddy's certmagic library (see #15848) (#15859) (#15878)
authorzeripath <art27@cantab.net>
Sat, 15 May 2021 17:28:14 +0000 (18:28 +0100)
committerGitHub <noreply@github.com>
Sat, 15 May 2021 17:28:14 +0000 (18:28 +0100)
Co-authored-by: Blake Miner <miner.blake@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
cmd/web_letsencrypt.go

index 6c48d3e854fd026d021b0c15cbe08851792436c5..4d4d54419d330d63a2399ae218e72ae2b87dd282 100644 (file)
@@ -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}
@@ -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,
        })