Mongrel server trying to perform GET on 127.0.0.1
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.
##
12开发者_StackOverflow中文版7.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
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).
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.
精彩评论