ngrok is a tunneling, reverse proxy that establishes secure tunnels from a public endpoint to a locally running network service while capturing all traffic for inspection and replay. It is an open-source project on GitHub.
ngrok creates a tunnel from the public internet to a port on your local machine. You can give this URL to anyone to allow them to try out a web site you’re developing without doing any deployment.
It captures all traffic through the tunnel. It displays information about the HTTP traffic for your inspection. Raw request/response bytes, parsed headers and form data, JSON/XML syntax checking and more are included. It can also replay requests.
Setup & Installation
- First go to ngrok website and create a free account.
- ngrok is easy to install. Download a single binary with zero run-time dependencies Based on Your Linux Distros Or Enter the following command :
cd ~ wget [ngrok-zip-file-address]
3. Unzip Downloaded File using this command (On Linux or OSX you can unzip ngrok from a terminal with the following command):
4. generate permission to ngrok file using:
sudo chmod +x ngrok
5. Connect your account. Running this command will add your account’s authtoken to your ngrok.yml file. This will give you more features and all open tunnels will be listed in the your dashboard.
./ngrok authtoken <YOUR_AUTHTOKEN>
Fire it up and use ngrok
Read the documentation on how to use ngrok. Try it out by running it from the command line:
To start a HTTP tunnel on port 80, run this next:
./ngrok http 80
To start a TCP tunnel on port 4444, run this next:
./ngrok tcp 4444
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" 8080
Tunnels on custom region
You can use custom region by using
-region , Example:
./ngrok http -region=us 80
OK, That’s it!
For more information, please go to ngrok Documentation page.