Backend Development 4 min read

How to Expose a Local Server to the Internet with ngrok (and a Brief Look at localtunnel)

This article explains why and how to expose a locally running server to the public internet using ngrok, demonstrates installation and usage steps including region configuration, compares it briefly with the open‑source localtunnel tool, and notes security considerations for development testing.

System Architect Go
System Architect Go
System Architect Go
How to Expose a Local Server to the Internet with ngrok (and a Brief Look at localtunnel)

After a brief personal note about a weekend team‑building trip, the author introduces the common development scenario where an internal service must be reachable by third‑party systems (e.g., payment gateways) and outlines three typical solutions, highlighting the convenience of using a tunneling tool.

ngrok is presented as a service that keeps your server running locally while providing a publicly accessible, verified domain; ngrok acts as a man‑in‑the‑middle, forwarding traffic between the public URL and your local process.

Installation : download the binary from the official website and unzip it.

Prepare a server : a simple Node.js "Hello World" application is sufficient (see screenshot in the original article).

Start the Node server with your usual tool (nodemon, forever, pm2, etc.).

Run ngrok to expose the server:

ngrok http 3000

ngrok will display a public HTTP and HTTPS URL; opening that URL in a browser shows the "Hello World" page, confirming that the tunnel works.

To improve latency by using a server closer to you, specify a region (e.g., Singapore):

ngrok http 3000 -region ap

ngrok also supports HTTPS, authentication, TLS/TCP tunnels, and other protocols; refer to the official documentation for details.

localtunnel is an open‑source alternative hosted on GitHub under the MIT license; it runs on a single personal server in the United States and may be less stable, so the author recommends ngrok for most cases.

In conclusion, ngrok provides a simple and practical way to expose local services for development and testing, and HTTPS can be used to protect data even though the service acts as a proxy.

developmenttestingnetworkingtunnelingNgroklocaltunnel
System Architect Go
Written by

System Architect Go

Programming, architecture, application development, message queues, middleware, databases, containerization, big data, image processing, machine learning, AI, personal growth.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.