Expose Localhost to the Outside with Ngrok

In Devops
July 18, 2023

Ngrok is used to quickly make your local machine or development environment accessible over the internet and for testing purposes.

Ngrok allows you to make your machine or application accessible through a public IP, enabling access and testing through a publicly available URL. It acts as a reverse proxy. What makes Ngrok particularly attractive is its simplicity of use. Let’s install Ngrok on our machine and start testing. You can quickly install Ngrok using the installation method provided in the following link, based on your operating system:



After completing the installation, let’s activate port 8080 with the following command:

ngrok http 8080

A URL appears in front of us as shown in the image below:

Now let’s send a curl request to this URL from an external machine, and you can monitor the request from the UI:

Lastly, you can also monitor the incoming traffic with the following command:

echo -e “HTTP/1.1 200 OK\r\n$(date)\r\n\r\n
hello world from $(hostname) on $(date)
” | nc -vl 808