summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-09-18 09:45:21 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-09-18 09:45:21 -0600
commitbc9f9448370d7a5535b33e7407760998b4875e45 (patch)
treeca4481d3f3cd14e95d03cd0fbc4788b4191571d5 /modules
parent4c289fc6ad3d7c2afa69e36cdf2cc9a172cb1c9c (diff)
host matcher: Strip [ ] from IPv6 addresses
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/matchers.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go
index 9cf52dc..3eaf48f 100644
--- a/modules/caddyhttp/matchers.go
+++ b/modules/caddyhttp/matchers.go
@@ -112,6 +112,10 @@ func (m MatchHost) Match(r *http.Request) bool {
if err != nil {
// OK; probably didn't have a port
reqHost = r.Host
+
+ // make sure we strip the brackets from IPv6 addresses
+ reqHost = strings.TrimPrefix(reqHost, "[")
+ reqHost = strings.TrimSuffix(reqHost, "]")
}
outer: