I installed Rails 4.2.0.beta2 per the instructions in RailsTutorial.org 3rd Edition (the one that just came out). I'm not using the cloudIDE and am instead using Ubuntu Trusty 32 via Vagrant on a Windows 7 host with RVM.
Did rails _4.2.0.beta2_ new hello_app
and then pasted in his gemfile sample.
After that, I ran:
$ bundle install
$ rails s
Server starts fine, however when I try to connect to localhost:3000
I get "Server Not Found"
Weirder still, I have a couple other Rails starter projects I've been tinkering with that use Rails 4.0.3 and 4.1.6 and I'm able to connect to the server there just fine.
What am I missing here? Why can't my browser connect when I've created a new Rails project with the latest version, but it works fine with older versions?
Also, I tried wget http://0.0.0.0:3000
and while it connected and received a 200 response, the length was unspecified, whereas in another brand new Rails app under an old version, I would get the actual file size of whatever index.html
was.
Rails 4.2 by default binds to
127.0.0.1:3000
, instead of0.0.0.0:3000
in earlier versions. If you have other Rails project working with your configuration, try to start a server with explicit host:rails s -b 0.0.0.0
.Regarding inaccessible server, from the Rails 4.2 release notes:
127.0.0.1:3000
will only allow connections from that address on port 3000, whereas0.0.0.0:3000
will allow connections from any address at port 3000.Since Rails 4.2 only accepts connections from localhost by default, you can only access the server from localhost (eg. inside the VM); connections from another machine (eg. VM's host) will not work.
You must use the "old behavior" method described above to allow connections from the VM host.
Regarding unspecified content length, that depends on the web server in use. I assume it is using chunked encoding which does not send content length. Assets will have content length, but not HTML.
A guy named tostasqb posted a very interesting workaround on github to make the old behavior (Rails version < 4.2) the default.
Just edit your config/boot.rb file and add these lines:
Modify your gemfile to something like this and run bundle update. The versions you have specified are explicit. New hello_world worked for me if I did not paste in your gemfile.