summaryrefslogtreecommitdiff
path: root/caddyconfig/httpcaddyfile
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2021-02-01 17:02:01 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2021-02-01 17:02:01 -0700
commitc986110678458f032018ff931273f8b6e1921e38 (patch)
tree99485cd370266448848a369c7aea31f3832a6be2 /caddyconfig/httpcaddyfile
parent55e49ff5c88170b8978cb322dfea3688fb6d3b97 (diff)
httpcaddyfile: Warn if site address uses unspecified IP (close #4004)
Diffstat (limited to 'caddyconfig/httpcaddyfile')
-rw-r--r--caddyconfig/httpcaddyfile/httptype.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go
index 2e7dd7c..0a5149f 100644
--- a/caddyconfig/httpcaddyfile/httptype.go
+++ b/caddyconfig/httpcaddyfile/httptype.go
@@ -17,6 +17,7 @@ package httpcaddyfile
import (
"encoding/json"
"fmt"
+ "log"
"reflect"
"regexp"
"sort"
@@ -471,6 +472,13 @@ func (st *ServerType) serversFromPairings(
hosts := sblock.hostsFromKeys(false)
+ // emit warnings if user put unspecified IP addresses; they probably want the bind directive
+ for _, h := range hosts {
+ if h == "0.0.0.0" || h == "::" {
+ 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)
+ }
+ }
+
// tls: connection policies
if cpVals, ok := sblock.pile["tls.connection_policy"]; ok {
// tls connection policies