From ec368396ff88cc8e630ebd85684d94b8a16de4bc Mon Sep 17 00:00:00 2001 From: sharego Date: Sun, 14 Jun 2026 13:00:43 +0800 Subject: [PATCH] Enhance just one wildcard matching for host patterns --- modules/caddyhttp/matchers.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go index 9f84a90da..7a9042367 100644 --- a/modules/caddyhttp/matchers.go +++ b/modules/caddyhttp/matchers.go @@ -342,7 +342,11 @@ outer: } host = repl.ReplaceAll(host, "") - if strings.Contains(host, "*") { + + // a single * always match + if host == "*" { + return true, nil + } if strings.Contains(host, "*") { patternParts := strings.Split(host, ".") incomingParts := strings.Split(reqHost, ".") if len(patternParts) != len(incomingParts) {