【发布时间】:2020-04-05 15:35:22
【问题描述】:
我在看一个(虽然很老)security talk on insecure rails defaults。我想知道是否有办法判断 Rails 现在是否默认绑定到 ip 127.0.0.1,端口 3000?当我启动 rails s 时,我看到了
± |master {1} U:4 ✗| → rails s
=> Booting Puma
=> Rails 6.0.2.2 application starting in development
=> Run `rails server --help` for more startup options
/Users/pivotal/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.2/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/pivotal/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.2/lib/action_dispatch/middleware/static.rb:110: warning: The called method `initialize' is defined here
Puma starting in single mode...
* Version 4.3.3 (ruby 2.7.0-p0), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://**127.0.0.1**:3000
* Listening on tcp://[::1]:3000
Use Ctrl-C to stop
根据pretty old Stack overflow post,我尝试将以下内容添加到我的 boot.rb 中,但我的 Spring 版本出现错误。
引导.rb 需要'rails/commands/server'
module Rails
class Server
def default_options
super.merge({Port: 10524, Host: '127.0.0.1'})
end
end
end
± |master {1} U:4 ✗| → rails s
You've tried to invoke Spring when it's already loaded (i.e. the Spring constant is defined).
This is probably because you generated binstubs with Spring 1.0, and you now have a Spring version > 1.0 on your system. To solve this, upgrade your bundle to the latest Spring version and then run `bundle exec spring binstub --all` to regenerate your binstubs. This is a one-time step necessary to upgrade from 1.0 to 1.1.
我执行了这些步骤,但仍然出错。
【问题讨论】:
-
数你的零
-
我已经发布了解决方案。 Solutions Here
标签: ruby-on-rails ruby ruby-on-rails-6