-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better errors works with localhost but not ngrok #306
Comments
I encountered the same issue so I added a feature that allows for domain specification. Use it by adding this to your development.rb:
I'll submit a pull request but for now, you'll have to modify your Gemfile to point to my fork:
|
That's awesome! Great content for a pull request. I'm jealous that I didn't do it first! |
Apologies for reviving an old issue. Are you sure this is something you want to do? It is putting a lot of trust in @inconshreveable (the creator of ngrok), possibly anyone on your local wifi (depending on the specifics of the network you are on/if you are using a VPN/etc), any machine your DNS request pass through to get the IP for ngrok, and likely others. Domain information ( If the ngrok subdomain is known to an attacker and you have Seems 🔥 really bad 🔥 for little to no upside. |
So I think really what's wrong here is the README doc which says:
This confused me because with a tunnel service, the REMOTE_ADDR is still 127.0.0.1. In fact the better_errors Middleware is using request.ip, which has a more complex definition such that your forwarded address is what gets set: http://stackoverflow.com/questions/10997005/whats-the-difference-between-request-remote-ip-and-request-ip-in-rails Anyway, the solution I came up with is in my development.rb to put:
On app boot this adds my current remote IP to the allowed list, and better_errors works locally. Won't show up for anyone else you give your ngrok address to, but then you likely don't want it to. |
Hey I'm using ngrok and http auth in order to protect my app. |
This would now be
|
Not sure on other proxying services, but when I throw an exception in my application and load the page using localhost:3000 better errors loads as expected. When I do the same in ngrok however I don't see the better errors page, I just see the standard Rails error page. Not sure what I'm doing wrong to configure that or why that would be occurring in the first place.
The text was updated successfully, but these errors were encountered: