LoginSignup
40
42

More than 5 years have passed since last update.

better_errorsがvagrantで動作しない対処

Last updated at Posted at 2013-11-26

Rails4 今のところ最強なデバッグツール達
http://qiita.com/yusabana/items/8ce54577d959bb085b37

better_errorsが動かない・・・

こちらにならって、vagrant環境にrailsを構築していたので、
デバッグに便利なbetter_errorsをgemからインストールしたが
・・・・動かず。

公式githubにこのようにありました。
https://github.com/charliesome/better_errors#security

You will notice that the only machine that gets the Better Errors page is localhost, which means you get the default error page if you are developing on a remote host (or a virtually remote host, such as a Vagrant box)
↓
超訳:localhostのみで表示され、リモートホストやVagrantでは出ないよ

対処法

rails内にある、config/environments/development.rbに以下を追加

BetterErrors::Middleware.allow_ip! "192.168.33.1"
(※vagrantが config.vm.network :private_network, ip: "192.168.33.10" の場合)

vagrantのデフォルトでは、192.168.33.1から192.168.33.10にアクセスすることになるので、
192.168.33.1をallowすることで使えるようになりました。

非常に便利!!

40
42
1

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
40
42