【发布时间】:2011-08-21 02:48:18
【问题描述】:
我最近启动了一个从 github 签出的 Rails 3 项目。该应用程序使用子域来访问帐户,因此我必须在我的 etc/hosts/ 文件中执行一些小更改,以便应用程序正确导航。我现在正在尝试登录应用程序,但在终端中看到一个非常奇怪的请求:
Started GET "/session/new" for 127.0.0.1 at Sun May 08 13:48:38
我正在使用 mongrel 服务器,它在 ip 0.0.0.0 上运行,所以我无法弄清楚为什么应用程序正在查找 127.0.0.1。我在 OS X 上,所以我也停止了我的本地 apache 服务器。
我已经在我的应用程序中删除了字符串 "127.0.0.1" 的所有痕迹,但仍然看到对该 IP 发出的请求。
有人知道为什么会这样吗?
编辑:主机文件如下:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost ger.mpt.local
255.255.255.255 broadcasthost
#::1 localhost
#fe80::1%lo0 localhost
编辑:我还应该提到,当我提交登录表单时,我从 firebug 获得了 302 重定向状态。
谢谢, 齿轮
【问题讨论】:
-
你在浏览器中输入什么网址?
-
"gearoid.myapp.local" 在 etc/hosts 文件中解析为 ip 0.0.0.0
-
没关系,你不用担心,0.0.0.0表示监听所有接口,127.0.0.1是回环接口的默认IP。
标签: ruby-on-rails localhost mongrel