mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
Merge pull request #51 from ChannelMeter/tls/disable-http
tls: suggestion - disable tls if port is http?
This commit is contained in:
commit
97e702b963
1 changed files with 11 additions and 1 deletions
|
@ -1,9 +1,19 @@
|
||||||
package setup
|
package setup
|
||||||
|
|
||||||
import "github.com/mholt/caddy/middleware"
|
import (
|
||||||
|
"github.com/mholt/caddy/middleware"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
func TLS(c *Controller) (middleware.Middleware, error) {
|
func TLS(c *Controller) (middleware.Middleware, error) {
|
||||||
c.TLS.Enabled = true
|
c.TLS.Enabled = true
|
||||||
|
if c.Port == "http" {
|
||||||
|
c.TLS.Enabled = false
|
||||||
|
log.Printf("Warning: TLS was disabled on host http://%s."+
|
||||||
|
" Make sure you are specifying https://%s in your config (if you haven't already)."+
|
||||||
|
" If you meant to serve tls on port 80,"+
|
||||||
|
" specify port 80 in your config (http://%s:80).", c.Host, c.Host, c.Host)
|
||||||
|
}
|
||||||
|
|
||||||
for c.Next() {
|
for c.Next() {
|
||||||
if !c.NextArg() {
|
if !c.NextArg() {
|
||||||
|
|
Loading…
Reference in a new issue