3 ms·
What ngrok does can also be achieved with the following simple ssh command: ssh -R 9000:localhost:4200 my.server.is.awesome.com Boom, your local server is rea
by arianvanp 11y ago
What ngrok does can also be achieved with the following simple ssh command:
ssh -R 9000:localhost:4200 my.server.is.awesome.com
Boom, your local server is reachable on my.server.is.awesome.com:9000
It's actually quite a useful trick that I use when needing to test integration with 3rd parties when on the dev branch of our API code.
If you like these kind of tricks. I'd really advice watching this talk. https://vimeo.com/54505525 https://vimeo.com/54505525
- nealrs 11y agoNeat -- but you still need to have an existing domain + ssh access to that domain right?
- arianvanp 11y agoYes or you can use an IP address of course.
- stenius 11y agoA lot of people I've worked with at hackathons didn't have a server running so being able to use ngrok is a lot easier for them.
- pkaeding 11y agoThat is true, but that is only a small part of the usefulness of ngrok. It can tunnel TCP port, assigning you a random high-numbered port at their end (like with ssh -R). But if you are tunneling an HTTP service, you can be assigned a random hostname (random.ngrok.com), or you can request a specific hostname (pkaeding-test.ngrok.com), and your service will be available over both HTTP (port 80) and HTTPS (port 443) on that hostname. This can be critical for testing webhook callbacks where the remote service only allows HTTPS on port 443. Also, when you are tunneling HTTP services (using HTTP or HTTPS), ngrok will start a web UI running at localhost:3030, detailing all incoming requests. You can examine the headers and body from both request and response, and even replay requests. This is immensely helpful when debugging webhooks. (I am not affiliated with ngrok, except as a happy user.)
- arianvanp 11y agoYeh true. But what I do in those scenarios is hack up an ngnix config with a (self-signed) wildcard certificate and map certain ports to https endpoints on certain subdomains using ngnix reverse-proxy stuff. So I expose :9000 on the remote host, and then map :9000 to blah.my.website.com:443 using ngnix
- pkaeding 11y agoYeah, that definitely works as well, and it is also what I did before I found ngrok. It is a few more hoops to jump through in order to get things flowing, though, and you don't get the introspection/replay functionality. You can use wireshark to inspect the traffic, I suppose, but again, it isn't as easy.