summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/marshalers.go
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2023-03-27 16:22:59 -0400
committerGitHub <noreply@github.com>2023-03-27 20:22:59 +0000
commit05e9974570a08df14b1162a1e98315d4ee9ec2ee (patch)
treee11e345766dc53c25f901a7402ceb489b4416fe9 /modules/caddyhttp/marshalers.go
parent330be2d8c793147d3914f944eecb96c18f2eabff (diff)
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
Diffstat (limited to 'modules/caddyhttp/marshalers.go')
-rw-r--r--modules/caddyhttp/marshalers.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/caddyhttp/marshalers.go b/modules/caddyhttp/marshalers.go
index e6fc3a6..9a955e3 100644
--- a/modules/caddyhttp/marshalers.go
+++ b/modules/caddyhttp/marshalers.go
@@ -40,6 +40,7 @@ func (r LoggableHTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error {
enc.AddString("remote_ip", ip)
enc.AddString("remote_port", port)
+ enc.AddString("client_ip", GetVar(r.Context(), ClientIPVarKey).(string))
enc.AddString("proto", r.Proto)
enc.AddString("method", r.Method)
enc.AddString("host", r.Host)