mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 07:43:17 +00:00
caddyhttp: Determine real client IP if trusted proxies configured (#5104)
* caddyhttp: Determine real client IP if trusted proxies configured * Support customizing client IP header * Implement client_ip matcher, deprecate remote_ip's forwarded option
This commit is contained in:
parent
330be2d8c7
commit
05e9974570
9 changed files with 462 additions and 187 deletions
|
@ -232,6 +232,11 @@ func (app *App) Provision(ctx caddy.Context) error {
|
|||
srv.trustedProxies = val.(IPRangeSource)
|
||||
}
|
||||
|
||||
// set the default client IP header to read from
|
||||
if srv.ClientIPHeaders == nil {
|
||||
srv.ClientIPHeaders = []string{"X-Forwarded-For"}
|
||||
}
|
||||
|
||||
// process each listener address
|
||||
for i := range srv.Listen {
|
||||
lnOut, err := repl.ReplaceOrErr(srv.Listen[i], true, true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue