aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBlake Miner <miner.blake@gmail.com>2021-05-14 10:39:10 -0400
committerGitHub <noreply@github.com>2021-05-14 15:39:10 +0100
commite2f39c2b64e1c5360702e507e0cac56255ca61c3 (patch)
tree1ee4fd56703bab06e1d11d20028c32dc10e462cd /cmd
parentdf72cf62111114237324857d1393d31312bccca9 (diff)
downloadgitea-e2f39c2b64e1c5360702e507e0cac56255ca61c3.tar.gz
gitea-e2f39c2b64e1c5360702e507e0cac56255ca61c3.zip
Fix bound address/port for caddy's certmagic library (see #15848) (#15859)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web_letsencrypt.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/web_letsencrypt.go b/cmd/web_letsencrypt.go
index 9cfc9b3ab2..15a3c92e8b 100644
--- a/cmd/web_letsencrypt.go
+++ b/cmd/web_letsencrypt.go
@@ -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,
})