20 August 2014

ngrok is a convenient tool to expose your local web server to the internet . While working with some third-party services, you may need to accept callback requests in your development environment. In that case,you might need ngrok to make the third-party service resolve your localhost like a valid domain.

To install and use ngrok, download it from there website here. It’s a ready to run, bash script. Unzip it to some directory of your choice. Then, make sure you have the server running on a port e.g. rails server on port 3000. Now, run ngrok as a bash script with your port address as an argument :

./ngrok 3000

You will get the web address of your application in the forwarding section of the command line output.

ngrok                        (Ctrl+C to quit)

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

You can now access your local application from “http://2b034acd.ngrok.com”.