Expose your localhost to web in 50 seconds using Ngrok


An introduction to Open Source Technology

The term “Open Source” in general refers to something that can be modified because its design is publicly accessible. Open source technology is defined as the production and development philosophy of allowing end users and developers to not only see the source code of software, but modify it as well. Ngrok is one such project developed by GitHub.

What is Ngrok?

Ngrok 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.


How does Ngrok works            Image Source: https://ngrok.com/

Why Ngrok? & How we have deployed it in Vmoksha?

Before using ngrok, when we needed to expose a localhost application to web (internet) all we were doing is deploying the application in a server running a DMZ or we used to relocate the host to DMZ and configure NATing in the firewall. We also used to make DNS configuration in External DNS where the domain is hosted. In general, DMZ (De-Militarized Zone) is a computer host or small network inserted as a “neutral zone” between a company’s private network and the outside public network. It prevents outside users from getting direct access to a server that has company data. The following are the issues that we were facing before Ngrok deployment:

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


Architecture before Ngrok deployment


Architecture before Ngrok deployment


Real-time Ngrok Usage in Vmoksha (A Case Study):

After using Ngrok, we had addressed all the about requirements and mainly it serves our business need in faster, secure and easy manner.  Here is the following how we had used the features of Ngrok in our (Vmoksha) environment. In our scenario we used ngrok in Windows as follows:

As this is a small 9MB executable(.exe) tool we can be generally executed with Ngrok command followed by the port no which has to be exposed as follows,



Which gives a random subdomain on Ngrok.com and it’ll be accessible over both HTTP and HTTPS (Secure).



Running Multiple Tunnels Simultaneously:

We are using an extensive feature of Ngrok i.e., we can run multiple tunnels simultaneously and a few tunnel configuration is shown in the following YML configuration file.


 Sample XML code
Sample XML code for running multiple tunnels simultaneously (.yml file)


We can start all four tunnels simultaneously by using Ngrok start command followed by the names of the tunnels we want to start:


Ngrok start command


The Output Terminal will look something like this:


The Output Terminal

Request inspection with the Web Interface:

Web Interface is accessible on using which we can inspect all the http traffic requests over the tunnel. We can also replay them to make the debugging quicker and easier.


Sample Web Interface for HTTP Traffic Inspection: 

Sample Web Interface for HTTP Traffic Inspection


Architecture after Ngrok deployment

Architecture after Ngrok deployment




All in all, this is an amazing, secure and powerful tool that helps to meet our business needs on right time.


About Abdullah Kajamohideen

Abdullah is young passionate person, researching and implementing new technologies in IT Infrastructure Management. He enjoys working on multiple cross platform technologies, video gaming, reading books, Photoshop designing, Macromedia animation, surfing, and shopping, etc.

One comment on “Expose your localhost to web in 50 seconds using Ngrok

  1. Senthilnathan

    Very useful and informative blog post. Well written with scenario “before” and “after” implementation. The diagrams used are excellent.

    It would be great if Vmoksha can write an exclusive blog post on how and what tool has been used for diagramming purpose. Looking forward to see many such informative articles from Abdullah and Vmoksha.

    Adding a photo about the author (Gravatar) will be good.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>