We run the default config from this repository.
our website(vue project) posts client side errors to sentry.
the user.ip tag from these errors is shown as the gateway ip of the docker network the stack runs in.
we would expect the public ip of the client in this tag.
the nginx config is default and uses x-forwarded-for header config.
we already did some testing with SENTRY_USE_X_FORWARDED_FOR = True and SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
with no positive result so far.
we currently have no luck finding related info on the documentation and other github issues are either older then 2 years or don't seem to have a definitive answer.
This is unfortunately a bug in Docker itself: moby/moby#15086. The only viable solution seems to be adding an HTTP load balancer in front (or something like CloudFlare) and then modify the nginx config to use the headers they pass down for the real client IP.
Will keep the issue open so we don't forget to document this.
/ping @mattrobenolt in case he has any other suggestions.
I had this issue, just fixed it by updating nginx/nginx.conf file:
proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Just replaced $remote_addr with $proxy_add_x_forwarded_for.
If you want the external ip in logs, also update "log_format" line.
Most helpful comment
I had this issue, just fixed it by updating nginx/nginx.conf file:
Just replaced $remote_addr with $proxy_add_x_forwarded_for.
If you want the external ip in logs, also update "log_format" line.