From 7cc8c7c8ebe9e79e875c7dd030a3142f74ce30d7 Mon Sep 17 00:00:00 2001 From: cyphercodes Date: Sun, 3 May 2026 10:58:06 +0300 Subject: [PATCH] fix: assert file matcher placeholder as string --- modules/caddyhttp/rewrite/rewrite.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/caddyhttp/rewrite/rewrite.go b/modules/caddyhttp/rewrite/rewrite.go index 5a17ec379..3500028f9 100644 --- a/modules/caddyhttp/rewrite/rewrite.go +++ b/modules/caddyhttp/rewrite/rewrite.go @@ -307,7 +307,9 @@ func escapePathPlaceholders(path string, r *http.Request, repl *caddy.Replacer) fileMatchRelativePlaceholder := "{http.matchers.file.relative}" if strings.Contains(path, fileMatchRelativePlaceholder) { if val, ok := repl.Get("http.matchers.file.relative"); ok { - path = strings.ReplaceAll(path, fileMatchRelativePlaceholder, escapePathPreservingSlashes(fmt.Sprint(val))) + if relativePath, ok := val.(string); ok { + path = strings.ReplaceAll(path, fileMatchRelativePlaceholder, escapePathPreservingSlashes(relativePath)) + } } }