diff --git a/core/host/supervisor.go b/core/host/supervisor.go index a94edeff..dec1b58b 100644 --- a/core/host/supervisor.go +++ b/core/host/supervisor.go @@ -31,6 +31,7 @@ type Configurator func(su *Supervisor) // Interfaces are separated to return relative functionality to them. type Supervisor struct { Server *http.Server + friendlyAddr string // e.g mydomain.com instead of :443 when AutoTLS is used, see `WriteStartupLogOnServe` task. disableHTTP1ToHTTP2Redirection bool closedManually uint32 // future use, accessed atomically (non-zero means we've called the Shutdown) closedByInterruptHandler uint32 // non-zero means that the end-developer interrupted it by-purpose. @@ -347,8 +348,9 @@ func (su *Supervisor) ListenAndServeAutoTLS(domain string, email string, cacheDi cache = autocert.DirCache(cacheDir) } - if domain != "" { + if strings.TrimSpace(domain) != "" { domains := strings.Split(domain, " ") + su.friendlyAddr = domains[0] hostPolicy = autocert.HostWhitelist(domains...) } diff --git a/core/host/task.go b/core/host/task.go index 83942446..3fd10652 100644 --- a/core/host/task.go +++ b/core/host/task.go @@ -22,8 +22,12 @@ import ( // This function should be registered on Serve. func WriteStartupLogOnServe(w io.Writer) func(TaskHost) { return func(h TaskHost) { - guessScheme := netutil.ResolveScheme(h.Supervisor.manuallyTLS) - listeningURI := netutil.ResolveURL(guessScheme, h.Supervisor.Server.Addr) + guessScheme := netutil.ResolveScheme(h.Supervisor.manuallyTLS || h.Supervisor.Fallback != nil) + addr := h.Supervisor.friendlyAddr + if addr == "" { + addr = h.Supervisor.Server.Addr + } + listeningURI := netutil.ResolveURL(guessScheme, addr) interruptkey := "CTRL" if runtime.GOOS == "darwin" { interruptkey = "CMD"