Skip to content

Commit

Permalink
vars: Allow overriding http.auth.user.id in replacer as a special c…
Browse files Browse the repository at this point in the history
…ase (#6108)
  • Loading branch information
francislavoie authored Mar 5, 2024
1 parent 3ae07a7 commit 5ed8689
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/caddyhttp/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 5ed8689

Please sign in to comment.