简体   繁体   中英

Rails 4 get remote ip address of client getting error “::1”

I have been wondering about getting ip of client, I always get value "::1" . I do this to get my local ip address

request.remote_ip

I have another rails application by doing that it works well with 127.0.0.1 as a result. Do you have suggestion for this. I would appreciate it. Thanks in advance.

::1 is the actual IP. It is an ipv6 loopback address (ie localhost). If you were using ipv4 it would be 127.0.0.1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM