From 2712dcd1f5392e7a22843614ea11b9cc57b49e3b Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Sun, 1 Nov 2015 19:01:22 -0700 Subject: [PATCH] tls: If port unspecified and user provides cert+key, use 443 --- caddy/setup/tls.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/caddy/setup/tls.go b/caddy/setup/tls.go index 89d6e467..8a726950 100644 --- a/caddy/setup/tls.go +++ b/caddy/setup/tls.go @@ -21,6 +21,7 @@ func TLS(c *Controller) (middleware.Middleware, error) { switch len(args) { case 1: c.TLS.LetsEncryptEmail = args[0] + // user can force-disable LE activation this way if c.TLS.LetsEncryptEmail == "off" { c.TLS.Enabled = false @@ -28,6 +29,13 @@ func TLS(c *Controller) (middleware.Middleware, error) { case 2: c.TLS.Certificate = args[0] c.TLS.Key = args[1] + + // manual HTTPS configuration without port specified should be + // served on the HTTPS port; that is what user would expect, and + // makes it consistent with how the letsencrypt package works. + if c.Port == "" { + c.Port = "https" + } default: return nil, c.ArgErr() }