Skip to content

Commit e0a8f95

Browse files
committed
caddyhttp: Normalize (lowercase) {label.N} placeholders
1 parent b866a9e commit e0a8f95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/caddyhttp/replacer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
289289
return prefix.String(), true
290290
}
291291

292-
// hostname labels
292+
// hostname labels (case insensitive, so normalize to lowercase)
293293
if strings.HasPrefix(key, reqHostLabelsReplPrefix) {
294294
idxStr := key[len(reqHostLabelsReplPrefix):]
295295
idx, err := strconv.Atoi(idxStr)
@@ -304,7 +304,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
304304
if idx >= len(hostLabels) {
305305
return "", true
306306
}
307-
return hostLabels[len(hostLabels)-idx-1], true
307+
return strings.ToLower(hostLabels[len(hostLabels)-idx-1]), true
308308
}
309309

310310
// path parts

0 commit comments

Comments
 (0)