@marcel91200 / caddy Mirror · read-only / commits / 5ed86896
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 15:45 UTC

vars: Allow overriding `http.auth.user.id` in replacer as a special case (#6108)

Francis Lavoie committed Mar 5, 2024 at 17:25 UTC 5ed8689629ed88832f015cb507332adde03faabe
1 file changed +6
modules/caddyhttp/vars.go
+6
@@ -57,6 +57,12 @@ func (m VarsMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next H
57 v = repl.ReplaceAll(valStr, "")
58 }
59 vars[keyExpanded] = v
60 +
61 + // Special case: the user ID is in the replacer, pulled from there
62 + // for access logs. Allow users to override it with the vars handler.
63 + if keyExpanded == "http.auth.user.id" {
64 + repl.Set(keyExpanded, v)
65 + }
66 }
67 return next.ServeHTTP(w, r)
68 }