Getting BetterErrors in Rails While Using Ngrok
By default, the BetterErrors gem only works for localhost. If you're using ngrok to access your rails server and you want to have access to BetterErrors, you'll need to whitelist the IP of the machine that ngrok is running on.
Add the following to development.rb
:
BetterErrors::Middleware.allow_ip!(NGROK_MACHINE_PUBLIC_IP)
# - or -
# Use an IP finding service to grab your public IP each time you start the server:
# (ipecho.net, api.ipify.org, etc.)
BetterErrors::Middleware.allow_ip!(open('http://api.ipify.org').read)
Tweet