LoginSignup
10
6

More than 3 years have passed since last update.

config.hosts Rails 6

Last updated at Posted at 2019-09-09

この記事ではRails6でのconfig.hostsの追加方法を記載します。

バージョン情報

rails 6.0.0
Ruby 2.6.3

config.hostsの追加

"hostname"の箇所はドメイン名に読み替えてください。
config/application.rbに追加しました。
config/environments/development.rbに追加する方法も他の記事で紹介してありましたが、私の環境では上手く動作しませんでした。

example-app/config/application.rb
module ExampleApp
 class Application < Rails::Application
 config.load_defaults 6.0
 config.hosts << "hostname"
end

下記の記事を参考にしました。
https://www.fngtps.com/2019/rails6-blocked-host/
https://qiita.com/taiteam/items/a37c60fc15c1aa5bb606
https://github.com/rails/rails/pull/33145

10
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
6