Wrong user ip (127.0.0.1)

Hi guys, I using grafana 8.1 with nginx (behind reverse proxy).

Why users IP history is equal to 127.0.0.1? How can I fix this to show real user ip? And why is showing 127.0.0.1? I only think about reverse proxy, but I need this to work my company.

I access grafana over (example): mycompany.com/dashboard

and nginx redirect this link to 127.0.0.1:3000/dashboard

any one can help me?

This is not a question about Grafana, but a question about using a reverse
proxy.

I am pretty unfamiliar with NginX, but I know that Apache has settings for
selecting whether the address passed on to the origin server (Grafana) is that
of the proxy (127.0.0.1 in your case) or that of the client.

The main thing to think about, though, is “how could Grafana reply?”

If you are using a reverse proxy, it is often because the client cannot
connect directly to the server (whereas it can connect to the proxy, and the
proxy can connect to the server).

If that is the case, then it’s probably also true that the server cannot
connect back to the client, so if the server (Grafana) were told the real IP
address of the client, it would not be able to reply, and the client would
fail to get a response from Grafana.

You also need to ensure that the IP address from which the client gets a
response is that same as the address it sent the original request to, so if it
sends a request to the IP of the reverse proxy and gets a response from the IP
of Grafana, it still won’t work.

However, given that you say all the requests are from 127.0.0.1, this means
your reverse proxy is running on the same server as Grafana is, so why are you
using NginX at all?

Why do your clients not simply connect directly to Grafana, get a response
from it, and get their real IP addresses logged as a result?

Antony.

yes, it’s really proxy problem. I solved writing this inside sites-enabled conf.

{

proxy_set_header    X-Real-IP        $remote_addr;
proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;

}