From ff5e43f341cce0cf79be9e68edcb58a1c13efda4 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Thu, 13 Aug 2020 07:24:46 +0300 Subject: [PATCH] AutoTLS: allow fallback servers to not run on :80 --- core/host/supervisor.go | 6 ++++-- iris.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/host/supervisor.go b/core/host/supervisor.go index dec1b58b..3dc044b5 100644 --- a/core/host/supervisor.go +++ b/core/host/supervisor.go @@ -407,9 +407,11 @@ func (su *Supervisor) runTLS(getCertificate func(*tls.ClientHelloInfo) (*tls.Cer } else { if srv.Addr == "" { srv.Addr = ":http" - } else if !su.manuallyTLS && srv.Addr != ":80" && srv.Addr != ":http" { - return fmt.Errorf("autotls: The HTTP-01 challenge relies on http://%s:80/.well-known/acme-challenge/", netutil.ResolveVHost(su.Server.Addr)) } + // } else if !su.manuallyTLS && srv.Addr != ":80" && srv.Addr != ":http" { + // hostname, _, _ := net.SplitHostPort(su.Server.Addr) + // return fmt.Errorf("autotls: The HTTP-01 challenge relies on http://%s:80/.well-known/acme-challenge/", hostname) + // } if srv.Handler == nil { // handler was nil, caller wanted to change the server's options like read/write timeout. diff --git a/iris.go b/iris.go index 5f84a3b4..a5f733db 100644 --- a/iris.go +++ b/iris.go @@ -614,7 +614,7 @@ var ( // a valid option when the caller wants just to customize the server's fields (except Addr). // With this host configurator the caller can customize the server // that letsencrypt relies to perform the challenge. - // LetsEncrypt Certification Manager relies on http://%s:80/.well-known/acme-challenge/. + // LetsEncrypt Certification Manager relies on http://example.com/.well-known/acme-challenge/. AutoTLSNoRedirect = func(getFallbackServer func(acmeHandler func(fallback http.Handler) http.Handler) *http.Server) host.Configurator { return func(su *host.Supervisor) { su.NoRedirect()