Share your localhost with the world using ngrok

ngrok is a small command line utility which lets people on different network to access your localhost. It does this by creating a tunnel from one of its subdomain (xyz.ngrok.com) to your localhost.

Working locally has huge advantages as compared to working on a remote server. You won’t have to go through the cycle of fetching files, editing them, and deploying.

But what if you want to share your localhost with people on a different network, without deploying it? That’s where ngrok comes in.

ngrok

ngrok is a small command line utility which lets people on different network to access your localhost. It does this by creating a tunnel from one of its subdomain (xyz.ngrok.com) to your localhost.

To get started, head on to the site and download it. You’ll be getting a executable shell script which is the utility itself. (That’s on OS X/Linux, I’m not really sure about Windows.)

You’ll probably want to symlink it to /usr/local/bin/ngrok or a place where you generally keep shell scripts.

Now execute the script. The most basic usage is to just do ngrok 80 – which makes your localhost on port 80 available on ngrok’s subdomain.

There are quite a few options for the script, ngrok -subdomain mynewrockingapp 80 , for example, will create a tunnel to subdomain of your choice.

Creating a free account unlocks lot of cool features, like choosing a default subdomain, username/password for authentication and so on. You can also choose your own subdomain (xyz.devilsworkshop.org), instead of ngrok’s.

ngrok also lets you debug HTTP requests and responses, and inspect traffic. You can access the interface at localhost:4040.

Link: ngrok

One Comment

Meet September 10, 2013

Vibin, thanks for sharing this post.