Skip to content

[cern] Make werkzeug log the client IP when using proxy

Ricardo Rocha requested to merge 4147-logproxyclientip into cern-newton


By default werkzeug is taking the REMOTE_ADDR as the client IP, which gives the proxy IP when using a reverse proxy. Check for the X-Forwarded-For header and also log that IP when it's available.

Werkzeug has a ProxyIP fixer which does something similar changing the REMOTE_ADDR env var, but this is not used for logging.

Change-Id: Ib61bd9ac6767f67f06c7e7a3158be959f9a898d3 Closes-Bug: #1666943

Conflicts: magnum/cmd/

Closes #4147

Merge request reports