mirror of
https://github.com/caddyserver/caddy.git
synced 2025-08-30 23:02:33 -04:00
caddyhttp: Normalize (lowercase) {label.N} placeholders
This commit is contained in:
parent
b866a9e099
commit
e0a8f9541d
@ -289,7 +289,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
|
||||
return prefix.String(), true
|
||||
}
|
||||
|
||||
// hostname labels
|
||||
// hostname labels (case insensitive, so normalize to lowercase)
|
||||
if strings.HasPrefix(key, reqHostLabelsReplPrefix) {
|
||||
idxStr := key[len(reqHostLabelsReplPrefix):]
|
||||
idx, err := strconv.Atoi(idxStr)
|
||||
@ -304,7 +304,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
|
||||
if idx >= len(hostLabels) {
|
||||
return "", true
|
||||
}
|
||||
return hostLabels[len(hostLabels)-idx-1], true
|
||||
return strings.ToLower(hostLabels[len(hostLabels)-idx-1]), true
|
||||
}
|
||||
|
||||
// path parts
|
||||
|
Loading…
x
Reference in New Issue
Block a user