-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot bind to 127.0.0.1/0.0.0.0 in Rails 4.2.0 beta 1 #12
Comments
This bit me as well because it breaks docker to bind to localhost. You can revert to the prior bind address with |
Hi, I came across the same problem. I was not able to connect to my server from virtual machines (and I wasted so much time to realize that it came from here). What caused this change ? Rails ? Unicorn ? Unicorn-rails ? |
I think this is related to this change in Rails 4.2.0: http://guides.rubyonrails.org/4_2_release_notes.html#default-host-for-rails-server |
@brucehsu is absolutly right.
|
@tostasqb Thanks! 👍 |
@tostasqb Thank You!!! |
Hi I just try to use 'rails server -b 0.0.0.0' but it still cannot work. How should I adjust my firewall? My machine is OS X Yosemite. :) |
👍 - noticed rails was binding to localhost on my vps by default, so specifying |
rails s --binding 0.0.0.0 |
Or you can do: config/boot.rb require 'rails/commands/server'
module Rails
class Server
def default_options
super.merge(Host: '0.0.0.0', Port: 3000)
end
end
end |
If you put the default options on if ARGV.first == 's' || ARGV.first == 'server'
require 'rails/commands/server'
module Rails
class Server
def default_options
super.merge(Host: '0.0.0.0', Port: 3000)
end
end
end
end The #!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
# Set default host and port to rails server
if ARGV.first == 's' || ARGV.first == 'server'
require 'rails/commands/server'
module Rails
class Server
def default_options
super.merge(Host: '0.0.0.0', Port: 3000)
end
end
end
end
require 'rails/commands' |
Did the trick for me. Just in case you're looking for a better solution: |
After switching to Unicorn on my new project using rails 4.2.0 beta1, I found that I cannot access subdomain via
http://lvh.me
. With further investigation, the problem appears to be related to a binding issue ofunicorn-rails
under 4.2.0 environment.Following tests are done in separate empty rails apps, on my MBPr with OSX 10.9.5, MRI 2.1.3.
Here's the output of
bundle exec rails s
under rails 4.1.6:And here's the one under rails 4.2.0 beta 1:
Seems like 4.2.0 changed its default listening behavior?
The text was updated successfully, but these errors were encountered: