ngrok is a free tool that allows us to tunnel from a public URL to our application running locally. ngrok allows you to expose a web server running on your local machine to the internet. Just tell ngrok what port your web server is listening on.
Easy to Install and Use
- Download the package for your system
- Unzip the package
Expose a web server on port 80 of your local machine to the internet
To install ngrok do the following:
$ ngrok HTTP 80
When you start ngrok, it will display a UI in your terminal with the public URL of your tunnel and other status and metrics information about connections made over your tunnel.
Installing your Authtoken
Many advanced features of the ngrok.com service described in further sections require that you sign up for an account. Once you've signed up, you need to configure ngrok with the authtoken that appears on your dashboard. This will grant you access to account-only features. ngrok has a simple 'authtoken' command to make this easy. Under the hood, all the authtoken command does is to add (or modify) the authtoken property in your ngrok configuration file.
$ ngrok authtoken <YOUR AUTHTOKEN>
Password protecting your tunnel
Anyone who can guess your tunnel URL can access your local web server unless you protect it with a password. You can make your tunnels secure with the -auth switch. This enforces HTTP Basic Auth on all requests with the username and password you specify as an argument.
$ ngrok http -auth="username:password" 80
Your tunnel is now protected using HTTP auth. Noone’s spying on your business!
It has a dashboard
When you start up ngrok it shows you the URL you are tunnelling through and another local URL, http://127.0.0.1:4040.The dashboard allows you to see the status of your tunnel, the requests you have made through it and the responses that came back from your application.