简体   繁体   中英

Get user IP with ruby on rails

My rails app works with nginx and unicorn. I try used

Socket.ip_address_list 
request.ip 

without success... How I can get user IP?

UPDATE I fix it by adding in host configutation

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

and use

request.remote_ip

request.remote_ip should work.

HTH

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