DEV Community

How to demo your localhost app using ngrok

Prince Wilson on August 08, 2017

Ngrok is a reverse proxy that allows you to expose your locally running web service to other developers. It’s a timesaver for developers when it co...
Collapse
 
swizzard profile image
sam

Thanks for letting me know. I'm personally very uncomfortable directing potentially sensitive/private traffic through a closed-source tool--there's no guarantee something underhanded won't be done with my data.

Collapse
 
ben profile image
Ben Halpern

Been using ngrok for a while and love it.

Collapse
 
jakedohm_34 profile image
Jake Dohm

Cool post, Prince!

Ngrok is also built into Laravel Valet (which is a "minimalist dev environment") so all you have to do is run valet share to fire up a quick public URL.

I also was excited to learn (from the comments) that you could password protect the site, and use a private domain for sharing.

Collapse
 
swizzard profile image
sam

is ngrok open source?

Collapse
 
marcuzy profile image
Oleg Krasavin

There are such tools on npm which you can host on your own server

Collapse
 
sammyisa profile image
Sammy Israwi

When making requests from your application, are they made from localhost or from the address ngrok gives you?

Collapse
 
marcuzy profile image
Oleg Krasavin • Edited

Definitely, your app is going to make a request from your own ip address. ngrok just creates a websocket connection between your local machine and ngrok's server. Every time, when someone requests your subdomain.ngrok.com, ngrok's server emit the request data through the websocket connection. Ngrok's client receives the data and requests corresponding localhost resource. That's to say, your application isn't linked to ngrok and knows nothing about it.

Collapse
 
maxcell profile image
Prince Wilson

Hey Paritosh! I appreciate that catch! Do you happen to know why the above wouldn't work before?

 
swizzard profile image
sam

They can say that, but without access to their source code how can anyone be sure? It just seems very odd to me that a piece of software targeted at developers would be closed-source.

Thread Thread
 
maurycyszmurlo profile image
Maurycy Szmurlo

There is neither no any insurrance that the open-source code shown on the repo is the one running on the server...

Collapse
 
marcuzy profile image
Oleg Krasavin

Yes, it's good one, but also it's quite unstable and slow

 
maxcell profile image
Prince Wilson

I will make sure to put an edit out and have other people know about the same thing. Thanks again for reading and for letting me know about the issue!