My server does not have a public IP address, so I do not know how to get the real IP address of the client.
This is my nginx configuration:
location / { proxy_pass http://domain1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
In my Rails application controller, both request.ip
and request.remote_ip
return the server gateway address.
How can I get the real IP address of the client?
How to get X-Forwarded-For value from a Rails request?
ethan
source share