I have an issue when i try to get client ip, it gives same ip address for every client. I added these lines to my nginx.conf file:
set_real_ip_from 127.0.0.1;
set_real_ip_from 0:0:0:0:0:0:0:1;
set_real_ip_from 192.168.56.1;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
#proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
(I am not sure to add this part.)
But it still not working. Does anyone have any suggestions?
question from:
https://stackoverflow.com/questions/65598384/how-to-get-client-real-ip-on-nginx-server 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…