@marcel91200 / caddy Mirror · read-only / commits / e0a8f954
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 11, 22:15 UTC

caddyhttp: Normalize (lowercase) {label.N} placeholders

Matthew Holt committed Aug 25, 2025 at 13:18 UTC e0a8f9541d155b7385b78d2b8bbe2fad53bb6295
1 file changed +2 -2
modules/caddyhttp/replacer.go
+2 -2
@@ -289,7 +289,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
289 return prefix.String(), true
290 }
291
292 - // hostname labels
292 + // hostname labels (case insensitive, so normalize to lowercase)
293 if strings.HasPrefix(key, reqHostLabelsReplPrefix) {
294 idxStr := key[len(reqHostLabelsReplPrefix):]
295 idx, err := strconv.Atoi(idxStr)
@@ -304,7 +304,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
304 if idx >= len(hostLabels) {
305 return "", true
306 }
307 - return hostLabels[len(hostLabels)-idx-1], true
307 + return strings.ToLower(hostLabels[len(hostLabels)-idx-1]), true
308 }
309
310 // path parts