5 ms·
A lot of people seem to be a bit confused about the point of ngrok, why it's useful, how much it costs, etc. Let me try and help out. :) For me, the killer f
by Lazare 10y ago
A lot of people seem to be a bit confused about the point of ngrok, why it's useful, how much it costs, etc. Let me try and help out. :)
For me, the killer feature for ngrok is testing/developing webhooks. You install ngrok in your dev environment, start it up, then point the stripe/slack/whatever webhook your working on at the generated URL.
ngrok will 1) proxy that request through to your dev environment 2) log the request 3) log the response 4) let you replay previous requests. It could not be more helpful for developing webhook handlers, and has literally saved me hours of work in the last couple of months alone.
Finally, the free tier is all you need for that; it gives you a unique ngrok subdomain which changes every time you start the tunnel and some (generous) usage caps, both of which are fine for this usage.
People pointing out the potential security issues are correct, but that's an argument to be careful and think about what you're doing. Besides, what's your proposed alternative? Because most of the obvious ones have equally troubling issues.
- planetix 10y ago> Besides, what's your proposed alternative? Setup a proper development environment that mirrors the production environment?
- nevi-me 10y agoIf you don't have a static IP that's internet-accessible, and that which you can arbitrarily point your domain to, how would you go about doing this? Some, if not most, services won't allow you to redirect cold to an IP address, they want some domain of sorts. There are alternatives, but I think "setup a proper dev environment" alone misses the point of what ngrok does. The 'easiest' alternative I've tried before was to VPN into my Linux box to get a static internal IP, use a spare domain for the webhook then internally redirect the webhook traffic to my local machine. In the end I'm achieving what ngrok is doing (and none of it involves setting up a proper dev environment, cos I would already have one anyways), but I'd like to hear of better alternatives :)
- tjoff 10y agoSurely you've heard of dynamic DNS?
- noway421 10y agonip.io and xip.io even could be used, but that won't help if there's no static ip. of course you can portforward your ip via vpn or ssh tunnel. And that's would be the exact equivalent of ngrok, but with way more time and frustration to set it up.
- noway421 10y agooups, meant "routable" instead of "static"
- ryanong 10y agoNgrok also works without port forwarding through a router
- floatboth 10y agoSurely you've noticed this: > don't have a static IP that's internet-accessible I am one of those people :) I don't pay my ISP extra for a "real" IP address, so I have literally no way to receive incoming connections from the internet into my home network, it's all behind their NAT.
- Lazare 10y agoYes, I have that. How does that help me quickly iterate on getting proper handling for inbound webhooks from Stripe? Stripe wants a URL to send the payloads too, and my proper development environment is (not surprisingly) running inside a vagrant on my dev machine inside our office LAN. I could open up a port on our firewall and forward it through to my laptop but: 1) ngrok is easier 2) ngrok provides additional features 3) This has every drawback ngrok has and more 4) None of this has anything to do with having a proper dev environment. :) Can't reply so an edit: Yes, ngrok is actually easier than port forwarding. Plus it has logging and replay.
- tjoff 10y agoI'd imagine that for this purpose a proper dev environment would well be isolated your "office LAN". ngrok can not possibly be easier than port forwarding.
- the_mitsuhiko 10y agoExcept it is. By far. And it works everywhere. I could do webhook development on a plane.
- nickjj 10y agongrok is way easier. Run `ngrok http 3000` or whatever port your app is running on and you're done. Now you have both an HTTP and HTTPS endpoint that you can publicly access. Some webhook providing services also require HTTPS. ngrok gives you that right off the bat. Setting up self signed certs and running nginx, or faking a FQDN and using xip so that you can register a real certificate seems like overkill if all you want to do is test a webhook. ngrok is also perfect for live demo'ing apps to clients.
- fredoliveira 10y ago> ngrok can not possibly be easier than port forwarding. Oh come on, of course it can. I use port forwarding myself, but ngrok literally makes testing remote webhooks as simple as running "ngrok". That's it. It's definitely what I recommend coworkers who just want a quick solution to test out 3rd party service integrations.
- zimbatm 10y agoThat's staging, usually there is only one per project. As a developer, ngrok makes it really easy to show-off your feature branch to customers/rest of the team, regardless of your location. And you're not dependent on having a CI deploying to per-branch environments.
- mcv 10y agoYour dev environment is never going to be identical to your production environment, because you don't write code directly in production. Test and acc should be identical to prod, but for dev that's pointless.
- mcv 10y agoThat's is exactly how I used it too: develop locally, but expose it to a payment provider's webhook call through ngrok. It's very convenient, and has the added advantage that you can replay the webhook call without going through the entire process at the payment provider.
- afarrell 10y agoIt is also really useful for teaching someone how to use webhooks if you are a SAAS provider writing API docs.
- joshjje 10y agoNot to mention you can quickly show somebody a url pointing to your internal dev web server without a public host name or opening your firewall.
- djangowithme 10y agoI actually tried using it in this manner recently to test paypal IPN notifications, but it seems like paypal denies the SSL installed on the ngrok urls. I had to setup a domain with letsencrypt instead.