0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

core: Disable TLS for sites where http is explicitly defined (fix)

This commit is contained in:
Matthew Holt 2015-10-16 11:47:13 -06:00
parent a17e9b6b02
commit c4a7378466

View file

@ -2,6 +2,7 @@ package setup
import (
"crypto/tls"
"log"
"strings"
"github.com/mholt/caddy/middleware"
@ -10,6 +11,12 @@ import (
func TLS(c *Controller) (middleware.Middleware, error) {
c.TLS.Enabled = true
if c.Port == "http" {
c.TLS.Enabled = false
log.Printf("Warning: TLS disabled for %s://%s. To force TLS over the plaintext HTTP port, "+
"specify port 80 explicitly (https://%s:80).", c.Port, c.Host, c.Host)
}
for c.Next() {
if !c.NextArg() {
return nil, c.ArgErr()