SDK client ip was wrong

I am using Sentry 8.21.0

I am using nginx before Sentry server for limit requests rate.When I using nginx,I find the SDK client ip was wrong.If Sentry server and nginx on the same machine, the client ip was 127.0.0.1 .
I am changing the http headers like “X-Real-IP” or “X-Forwarded-For” by nginx but they are not work.

I want to know why cause this, and what should I do.

Thank you!

Are you changing the headers with the correct values?
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Yes, I am ensure that headers are correct, because the nginx print access log was correct.