This has caught me out a couple of times now, so I’m blogging it in the hope it will help me to remember
If you’re running Rails, and using Virtual Box to test on other operating systems (such as working on a Mac and testing Internet Explorer) – or even accessing your local development site from other devices to test it – then you might also have run into it.
In Rails 4.2, a change in Rack meant that the server now listens on localhost instead of 0.0.0.0 by default.
That means if you’re trying to access your local development site via your IP address on an internal network, it’s not going to pick it up. The fix is to start the server with -b 0.0.0.0:
rails s -b 0.0.0.0
Beware, though – the reason for the change is to restrict malicious users from accessing and exploiting the app, so use with caution! If you’re in a coffee shop, at a conference, or even using a shared network in a co-working space, use with care, and use a firewall.