Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
httpcaddyfile: Warn if site address uses unspecified IP (close #4004)
Matthew Holt committed
Feb 1, 2021 at 17:02 UTC
c986110678458f032018ff931273f8b6e1921e38
1 file changed
+8
caddyconfig/httpcaddyfile/httptype.go
+8
@@ -17,6 +17,7 @@ package httpcaddyfile
17
import (
18
"encoding/json"
19
"fmt"
20
+ "log"
21
"reflect"
22
"regexp"
23
"sort"
@@ -471,6 +472,13 @@ func (st *ServerType) serversFromPairings(
472
473
hosts := sblock.hostsFromKeys(false)
474
475
+ // emit warnings if user put unspecified IP addresses; they probably want the bind directive
476
+ for _, h := range hosts {
477
+ if h == "0.0.0.0" || h == "::" {
478
+ log.Printf("[WARNING] Site block has unspecified IP address %s which only matches requests having that Host header; you probably want the 'bind' directive to configure the socket", h)
479
+ }
480
+ }
481
+
482
// tls: connection policies
483
if cpVals, ok := sblock.pile["tls.connection_policy"]; ok {
484
// tls connection policies