Get real IP address in local Rails development environment

前端 未结 8 590
眼角桃花
眼角桃花 2020-11-30 23:15

I have Rails 2.3.8, Ruby 1.8.7, Mongrel Web Server and MySQL database.

I am in the development mode and I need to find the real IP address

8条回答
  •  無奈伤痛
    2020-11-30 23:38

    Depends on how you access the url.

    If you access the url using http://127.0.0.1/.... or http://localhost/.... , you'll get 127.0.0.1 as the remote ip. If you are on a LAN, use http://{lan-ip}/....

    for e.g. http://172.20.25.210/.......

提交回复
热议问题