Commit 2712dcd1 authored by Matthew Holt's avatar Matthew Holt

tls: If port unspecified and user provides cert+key, use 443

parent cac58eaa
...@@ -21,6 +21,7 @@ func TLS(c *Controller) (middleware.Middleware, error) { ...@@ -21,6 +21,7 @@ func TLS(c *Controller) (middleware.Middleware, error) {
switch len(args) { switch len(args) {
case 1: case 1:
c.TLS.LetsEncryptEmail = args[0] c.TLS.LetsEncryptEmail = args[0]
// user can force-disable LE activation this way // user can force-disable LE activation this way
if c.TLS.LetsEncryptEmail == "off" { if c.TLS.LetsEncryptEmail == "off" {
c.TLS.Enabled = false c.TLS.Enabled = false
...@@ -28,6 +29,13 @@ func TLS(c *Controller) (middleware.Middleware, error) { ...@@ -28,6 +29,13 @@ func TLS(c *Controller) (middleware.Middleware, error) {
case 2: case 2:
c.TLS.Certificate = args[0] c.TLS.Certificate = args[0]
c.TLS.Key = args[1] 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: default:
return nil, c.ArgErr() return nil, c.ArgErr()
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment