diff options
author | Francis Lavoie <[email protected]> | 2024-03-05 17:25:38 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-05 22:25:38 +0000 |
commit | 5ed8689629ed88832f015cb507332adde03faabe (patch) | |
tree | eb0540a7071d393c8e65cb873132771f616c3e8a | |
parent | 3ae07a73dc057c3a12486b78872c5e1391ec7cc9 (diff) | |
download | caddy-5ed8689629ed88832f015cb507332adde03faabe.tar.gz caddy-5ed8689629ed88832f015cb507332adde03faabe.zip |
vars: Allow overriding `http.auth.user.id` in replacer as a special case (#6108)
-rw-r--r-- | modules/caddyhttp/vars.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/caddyhttp/vars.go b/modules/caddyhttp/vars.go index 917a15051..f5afe264a 100644 --- a/modules/caddyhttp/vars.go +++ b/modules/caddyhttp/vars.go @@ -57,6 +57,12 @@ func (m VarsMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next H v = repl.ReplaceAll(valStr, "") } 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) } |