For the first time since upgrading to OSX Yosemite, I need to view an app running on my machine from another machine on the same network. Previously, this was as simple as finding my internal IP address and using that with port 3000, eg. http://192.168.0.111:3000
.
However, I am now finding that with Yosemite this doesn't work. The application is definitely running and is available via localhost:3000
but not via my internal IP.
I have run the network utility port scanner and it shows that localhost exposes port 3000 but my IP doesn't. Other machines on the network that have yet to upgrade (10.7.5 and 10.9.5) are not having this issue.
Any help would be greatly appreciated.
Edit: According to the security and privacy pane of the system preferences, the Yosemite firewall is currently off - so that isn't causing the problem.
That environment is no different than the default ones, start a server with bin/rails server -e staging, a console with bin/rails console -e staging, Rails.env.staging? works, etc. By default Rails expects that your application is running at the root (e.g. / ). This section explains how to run your application inside a directory.
The config/database.yml file contains sections for three different environments in which Rails can run by default: The development environment is used on your development/local computer as you interact manually with the application. The test environment is used when running automated tests.
And last but not least, any kind of discussion regarding Ruby on Rails documentation is very welcome on the rubyonrails-docs mailing list .
In the rare event that your application needs to run some code before Rails itself is loaded, put it above the call to require "rails/all" in config/application.rb. In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself.
By default, rails server
will only accept connections from localhost. You can check this by looking at the console output:
Listening on localhost:3000, CTRL+C to stop
To listen on all addresses, which will allow you to connect from other machines on the local network, you must explicitly bind to a more permissive address. Try this:
rails server --binding=0.0.0.0
You should now see:
Listening on 0.0.0.0:3000, CTRL+C to stop
Now you can connect to your Rails app from elsewhere on your local network, by browsing to e.g. http://192.168.0.111:3000
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With