Secure Tunnels to localhost using ngrok

By | May 6, 2018

Secure Tunnels to localhost using ngrok

ngrok is a free tool that allows you to expose a web server running on your local machine to the internet. It includes additional functionality that makes it easy to install and manage itself as a native operating system service on Windows, OS X and Linux.

It is is a multiplatform tunnelling, reverse proxy software that establishes secure tunnels from a public endpoint such as internet to a locally running network service while capturing all traffic for detailed inspection and replay.

The following are the issues that we were facing before Ngrok deployment:

  1. Unable to expose localhost application directly to internet without DMZ & other network configuration
  2. Unable to demonstrate an application to Client on urgent basis
  3. Unable to share websites for testing purpose
  4. Develop any services which consume Webhooks (HTTP CallBacks)
  5. Can’t share a website temporarily that is running only on our developer machine
  6. Time Consuming on network and DNS configurations
  7. Can’t debug or inspect HTTP Traffic in a precise manner
  8. Can’t run networked services on machines that are firewalled off from the internet
  9. Unable to expose application behind http proxy
  10. Unable to forward non-http and non-local network services

It’s really easy to install and use

ngrok is built in Go so it is packaged as binaries for each major platform. To install ngrok do the following:

  1. Download the package for your system
  2. Unzip the package
  3. There is no step 3!

Once you have ngrok installed, using it to tunnel to an application running on, say, port 3000 is as easy as:

$ ./ngrok http 3000

Once you’ve unzipped the ngrok executable move it to a folder that’s in your $PATH then you can run ngrok from anywhere you want on the command line by just typing:

$ ngrok http 3000

It has a dashboard
http://127.0.0.1:4040

You can secure your tunnels

$ ngrok http -auth "user:password" 3000

You can use custom subdomains

$ ngrok http -subdomain=thisisreallycool 3000