LoginSignup
2
2

More than 5 years have passed since last update.

ステージング環境でもbetter_errorsを使えるようにする

Last updated at Posted at 2013-08-04

ローカル環境ではbetter_errorsが使えるのですが、そのままだとステージング環境に上げた時にbetter_errorsが使えません。
ステージング環境は普通グローバルIPを当てるので、全部のホストからbetter_errorsの画面が見えてしまうと irb で任意のシェルコードが実行できてしまうのでセキュリティ上見えないようになっています。

社内からのアクセスではbetter_errorsの画面が見たいと思うときがあると思うので、これを回避するためには development.rb の最後尾に以下を記述します。

config/environments/development.rb
BetterErrors::Middleware.allow_ip! "xxx.xxx.xxx.xxx"
[ "127.0.0.1", "210.xxx.yyy.zzz" ].each do |ip|
  BetterErrors::Middleware.allow_ip! ip
end

アクセスする予定のホストのIPアドレスを列挙します。

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