mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 22:23:48 +03:00
vars: Allow overriding http.auth.user.id
in replacer as a special case (#6108)
This commit is contained in:
parent
3ae07a73dc
commit
5ed8689629
1 changed files with 6 additions and 0 deletions
|
@ -57,6 +57,12 @@ func (m VarsMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next H
|
||||||
v = repl.ReplaceAll(valStr, "")
|
v = repl.ReplaceAll(valStr, "")
|
||||||
}
|
}
|
||||||
vars[keyExpanded] = v
|
vars[keyExpanded] = v
|
||||||
|
|
||||||
|
// Special case: the user ID is in the replacer, pulled from there
|
||||||
|
// for access logs. Allow users to override it with the vars handler.
|
||||||
|
if keyExpanded == "http.auth.user.id" {
|
||||||
|
repl.Set(keyExpanded, v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return next.ServeHTTP(w, r)
|
return next.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue