Mongrel 服务器尝试在 127.0.0.1 上执行 GET

发布于 2024-11-05 10:19:57 字数 828 浏览 1 评论 0原文

我最近启动了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

薄暮涼年 2024-11-12 10:19:57

嗯。 0.0.0.0 表示 Mongrel 监听与您的系统“关联”的每个 IP 地址,包括 localhostlocalhost 被定义为 localhost 的别名)代码>127.0.0.1 到处)。

Mmm. 0.0.0.0 means that Mongrel listens on every IP address "associated" with your system, including localhost (localhost is defined as an alias to 127.0.0.1 everywhere).

忘东忘西忘不掉你 2024-11-12 10:19:57

答案在于会话存储配置。

通过代码调试后,我可以看到会话并不能随时用于各种身份验证方法。经过更深入的检查,我发现了一个配置文件,它设置了从中获取会话的域。将其设置为“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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文