mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
add basicauth {user} to replacer (#1979)
This commit is contained in:
parent
c0efec52d9
commit
9619fe224c
1 changed files with 4 additions and 0 deletions
|
@ -79,6 +79,10 @@ func (a BasicAuth) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error
|
|||
// user; this replaces the request with a wrapped instance
|
||||
r = r.WithContext(context.WithValue(r.Context(),
|
||||
httpserver.RemoteUserCtxKey, username))
|
||||
|
||||
// Provide username to be used in log by replacer
|
||||
repl := httpserver.NewReplacer(r, nil, "-")
|
||||
repl.Set("user", username)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue