From 1b7ff5d76c7a3c67b6e0f9b51af78d1b227fdea3 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Tue, 18 Jan 2022 13:29:07 -0500 Subject: httpcaddyfile: Add `default_bind` global option (#4531) --- caddyconfig/httpcaddyfile/addresses.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'caddyconfig/httpcaddyfile/addresses.go') diff --git a/caddyconfig/httpcaddyfile/addresses.go b/caddyconfig/httpcaddyfile/addresses.go index e2e7771..b33c0f0 100644 --- a/caddyconfig/httpcaddyfile/addresses.go +++ b/caddyconfig/httpcaddyfile/addresses.go @@ -213,7 +213,11 @@ func (st *ServerType) listenerAddrsForServerBlockKey(sblock serverBlock, key str lnHosts = append(lnHosts, cfgVal.Value.([]string)...) } if len(lnHosts) == 0 { - lnHosts = []string{""} + if defaultBind, ok := options["default_bind"].(string); ok { + lnHosts = []string{defaultBind} + } else { + lnHosts = []string{""} + } } // use a map to prevent duplication -- cgit v1.2.3