0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rails】ホスト名をホワイトリストに登録する方法

Posted at

はじめに

特に設定をしていない場合には、任意のホスト名を指定してアクセスしようとした際に次のようなエラーが発生します。

Blocked host: sample-host.com
To allow requests to sample-host.com, add the following to your environment configuration:
    config.hosts << "sample-host.com"

エラー文に記載のとおりホスト名をホワイトリストに追加する必要があります。

ホワイトリストに追加する方法

次のようにconfig/environments/development.rbに追記しホスト名をホワイトリストに追加します。

development.rb

Rails.application.configure do

  config.hosts << "sample-host.com"

end

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?