Mongrel 服务器尝试在 127.0.0.1 上执行 GET
我最近启动了一个 Rails 3 项目,我从 github 上签出了该项目。该应用程序使用子域来访问帐户,因此我必须在我的 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 重定向状态。
谢谢, 齿轮
I've recently started a Rails 3 project which I checked out from github. The application uses subdomains to access accounts so I had to perform a small change in my etc/hosts/ file so that the app navigates properly. I'm now trying to login to the app but am seeing a very strange request in the terminal:
Started GET "/session/new" for 127.0.0.1 at Sun May 08 13:48:38
I'm using the mongrel server and its running on ip 0.0.0.0
so I can't figure out why the app is looking up 127.0.0.1
. I'm on OS X so ive stopped my local apache server too.
I've removed all traces of the string "127.0.0.1"
in my app but still see the request being made to that IP.
Does anyone have any idea's as to why this is happening?
EDIT: Hosts file is as following:
##
# 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
EDIT: I should also mention that I get a 302 redirect status from firebug when I submit the login form.
Thanks,
gearoid
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯。
0.0.0.0
表示 Mongrel 监听与您的系统“关联”的每个 IP 地址,包括localhost
(localhost
被定义为localhost
的别名)代码>127.0.0.1 到处)。Mmm.
0.0.0.0
means that Mongrel listens on every IP address "associated" with your system, includinglocalhost
(localhost
is defined as an alias to127.0.0.1
everywhere).答案在于会话存储配置。
通过代码调试后,我可以看到会话并不能随时用于各种身份验证方法。经过更深入的检查,我发现了一个配置文件,它设置了从中获取会话的域。将其设置为“mpt.local”允许会话被拾取,从而允许我登录。
The answer to this lay in the session storage configuration.
After debugging through the code I could see that the session wasn't being made readily available to various authentication methods. Upon deeper inspection I found a config file which set the domain which the session is picked up from. Setting that to "mpt.local" allowed the session to get picked up and thus allowed me to login.