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, 08:30 UTC
caddyhttp: Clean up variable scope in vars matcher
Matthew Holt committed
Jun 20, 2026 at 13:44 UTC
576038221326de302c418b58c4739d567cb0ba80
1 file changed
+2
-2
modules/caddyhttp/vars.go
+2
-2
@@ -181,7 +181,7 @@ func (m VarsMatcher) MatchWithError(r *http.Request) (bool, error) {
181
vars := r.Context().Value(VarsCtxKey).(map[string]any)
182
repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
183
184
- var matcherValExpanded, varStr, v string
184
+ var matcherValExpanded, varStr string
185
var varValue any
186
for key, vals := range m {
187
if strings.HasPrefix(key, "{") &&
@@ -211,7 +211,7 @@ func (m VarsMatcher) MatchWithError(r *http.Request) (bool, error) {
211
// user input like {env.SECRET} to be evaluated.
212
213
// see if any of the values given in the matcher match the actual value
214
- for _, v = range vals {
214
+ for _, v := range vals {
215
matcherValExpanded = repl.ReplaceAll(v, "")
216
if varStr == matcherValExpanded {
217
return true, nil