From a1081194bfae4e0d8c227ec44aecb95eded55d1e Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Fri, 20 Feb 2026 10:54:50 -0700 Subject: [PATCH] Merge commit from fork Necessary as otherwise the early-bail in `until = strings.IndexByte(remaining, nextCh) ... if until == -1` can cause a case-insensitive mismatch Co-authored-by: Asim Viladi Oglu Manizada --- modules/caddyhttp/matchers.go | 1 + modules/caddyhttp/matchers_test.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go index eda8cd3ae..27e5c5ae6 100644 --- a/modules/caddyhttp/matchers.go +++ b/modules/caddyhttp/matchers.go @@ -538,6 +538,7 @@ func (m MatchPath) MatchWithError(r *http.Request) (bool, error) { } func (MatchPath) matchPatternWithEscapeSequence(escapedPath, matchPath string) bool { + escapedPath = strings.ToLower(escapedPath) // We would just compare the pattern against r.URL.Path, // but the pattern contains %, indicating that we should // compare at least some part of the path in raw/escaped diff --git a/modules/caddyhttp/matchers_test.go b/modules/caddyhttp/matchers_test.go index b5e965b4a..160aa424f 100644 --- a/modules/caddyhttp/matchers_test.go +++ b/modules/caddyhttp/matchers_test.go @@ -417,6 +417,11 @@ func TestPathMatcher(t *testing.T) { input: "/ADMIN%2fpanel", expect: true, }, + { + match: MatchPath{"/admin%2fpa*el"}, + input: "/ADMIN%2fPaAzZLm123NEL", + expect: true, + }, } { err := tc.match.Provision(caddy.Context{}) if err == nil && tc.provisionErr {