One of my best finds of the 2014 was Ngrok, service providing secure tunneling from your local machine to the web. It allows you to expose your locally running server to on-line in just a seconds, moreover you are able to access it on http and https. Each developer can find multiple use-cases for this kind of service.

It's multi-platform, stable, simple to use and free of charge service. Of course if you need, you can buy a license but you don't need to.

Personally I use it extensively to demo beta projects for clients or to test behaviour of some apps when they run on HTPPS. I also use it whenever I work with some third party APIs where external web URL is required for callbacks. It also supports Websockets so I've tested the chat servers with Ngrok as well.

Ngrok definitely saves a lot of time and hustle with deploying new beta versions when any changes are made. No more port forwarding or remote server restarts.

1. How does it work

Ngrok comes along with a small command line tool that runs on your local machine and creates tunnel between your locally running server and on-line Ngrok server. The tool can be downloaded from here.

1.1 Run Ngrok client

Assuming your local server is running on port 8000, you can create tunnel by running client like that:

./ngrok http 8000

The tunnel will be created and our locally running server will be accessible externally on, through HTTP and HTTPS.

1.2 Custom sub-domain

Another useful feature, provided by Ngrok is possibility to create custom sub-domains, so the URL is easier to remember. To create custom sub-domain you need to create an account and authenticate your client. After login your auth key will be visible in your profile page.

Client is authenticated only once.

./ngrok authtoken < your auth token >

Now you're ready to expose your local server with sub-domain

./ngrok http -subdomain="mr-coffee" 8000

1.3 Debugging connection

For connection debugging purposes, Ngrok allow you to inspect the whole traffic that goes through the tunnel. You can access easy to work with, web interface that will by default run on your local machine port 4040.

It allows you to inspect request headers and trigger a reply for each request. Additionally you can check the tunnel status and stats.

1.4 Other functionality

Ngrok has much more to offer, features like:

  • Password protected tunnels
  • TCP tunnels
  • Websocket support
  • End-To-End TLS tunnels

And much more. For the full list of the features have a look on the official Ngrok website here.