Answer the question
In order to leave comments, you need to log in
How to get real IP address in nginx logs?
Good day, I have a trace. situation. There is a proxy nginx (with two interfaces: external IP and internal - 192.168.1.1), inside the network at the address 192.168.1.6, the nginx (backend) server also accepts requests. Everything works, but on the backend in the nginx logs I see the internal IP of the proxy server 192.168.1.1 And you need to see the client's IP I am attaching
the setting
server {
server_name ххххххх;
location / {
proxy_redirect off;
proxy_pass http://192.168.1.6;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question