Hi,
I want to save IP address for login members. How do I get IP address?
Hi,
I want to save IP address for login members. How do I get IP address?
On Thu, 27 Oct 2016 11:11:47 GMT, can wrote:
Hi,
I want to save IP address for login members. How do I get IP address?
You can get the raw address using HTTPServerRequest.clientAddress and .toAddressString() will convert that to an IP address string.
On Thu, 27 Oct 2016 18:11:55 GMT, Sönke Ludwig wrote:
On Thu, 27 Oct 2016 11:11:47 GMT, can wrote:
Hi,
I want to save IP address for login members. How do I get IP address?
You can get the raw address using
HTTPServerRequest.clientAddressand.toAddressString()will convert that to an IP address string.
OK. but this code always get 127.0.0.1 IP address. My project is behind nginx server and I want get client IP e.g. 187.95.121.48?
Am 29.10.2016 um 11:04 schrieb can:
On Thu, 27 Oct 2016 18:11:55 GMT, Sönke Ludwig wrote:
On Thu, 27 Oct 2016 11:11:47 GMT, can wrote:
Hi,
I want to save IP address for login members. How do I get IP address?
You can get the raw address using
HTTPServerRequest.clientAddressand.toAddressString()will convert that to an IP address string.OK. but this code always get 127.0.0.1 IP address. My project is behind nginx server and I want get client IP e.g. 187.95.121.48?
Ah okay, in that case you'd have to configure Nginx to forward the
client's IP as an HTTP header:
proxy_set_header X-Real-IP $remote_addr;
Then the IP would be accessible as req.headers["X-Real-IP"].