From Local Host to the Internet
A way to get your application from localhost to the internet(URL) with a single command, Ngrok and Cloudflare.
Problem
Let us admit we all faced it as developers, making some application run on local host, let us assume a simple Flask server running on localhost at port 5500. Then a client wants to access the same webpage who is located somewhere in the world. Just for this you cant get a domain host the application in a server or reroute the request to your machine, it is hectic.
“There should be a better way”
Solution
There are multiple solutions for this problem but Ngrok and Cloudflare Tunnel shine of them all. In this article i’ll be discussing about Ngrok.
Ngrok
Ngrok allows you to tunnel local ports to public URL and inspect the traffic. Installation: https://ngrok.com/download.
Create a free ngrok account.
Add the Auth Token.
./ngrok config add-authtoken <authtoken>
To create a http tunnel.
ngrok http <port>
This will create a URL which can be used to access the localhost application.
- Ngrok can also be used for TCP, TLS tunnels.
- You can get a custom subdomain by upgrading your plan.