diff --git a/README.md b/README.md index 7136372..f2c8bd9 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ location /webcal-proxy/ { rewrite ^/webcal-proxy/(.*)$ /$1 break; proxy_set_header Host $host; proxy_set_header X-Forwarded-URI /webcal-proxy; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; proxy_buffering off; } diff --git a/logging.go b/logging.go index ea3bc6f..0c07b99 100644 --- a/logging.go +++ b/logging.go @@ -32,9 +32,12 @@ func logging(c *gin.Context) { start := time.Now() log := logrus.WithFields(logrus.Fields{ - "req_method": c.Request.Method, - "req_url": c.Request.URL.String(), - "req_bytes": c.GetHeader("Content-Length"), + "req_method": c.Request.Method, + "req_url": c.Request.URL.String(), + "req_bytes": c.GetHeader("Content-Length"), + "downstream_remote_addr": c.Request.RemoteAddr, + "x_forwarded_for": c.GetHeader("X-Forwarded-For"), + "user_agent": c.GetHeader("User-Agent"), }) requestID := c.GetHeader("X-Request-ID")