Accessing localhost from the internet

On the latest edition of the excellent Javascript Jabber podcast one of their guests has suggested an excellent tool in their picks section. The tool is called ngrok. Ngrok makes your localhost available on the internet! Very handy if you want to test you local site on a mobile, tablet or share with someone outside of your network.

If you are interested you can download the tool from:

https://ngrok.com/download

There is a version available for Mac, Windows, Linux and ARM. The program is really simple to use. On the Mac you simply unzip and run by running ./ngrok from the terminal. This then gives the following output:


ngrok                                                                          (Ctrl+C to quit)

Tunnel Status                 online
Version                       1.7/1.6
Forwarding                    http://<address>.ngrok.com -> 127.0.0.1:80
Forwarding                    https://<address>.ngrok.com -> 127.0.0.1:80
Web Interface                 127.0.0.1:4040
# Conn                        0
Avg Conn Time                 0.00ms

Then you simply go to the address listed and you will be forwarded on to your machine on port 80. Note I have removed the address above.

From reading the documentation ngrok gets much cooler. It will give you a full detailed log of everything it’s captured on http://localhost:4040, allow you to replay requests, capture requests, forward requests on to another machine on the network and much more.

You can check out the source on github. Looks like the main contributer was Alan Shreve, great work Alan. Check out his website. I love the fact the community produce cool tools like this!