All notesProduct Distribution

Ngrok: Securely Exposing Local Applications to the Internet

Building software locally is fast and convenient, but sharing that work with others has always been a challenge.

Firdavs SalokhiddinovFirdavs Salokhiddinov
4 min read
1 bCqlb1A9sxxvswcYlM ROw

Whether you are demonstrating a web application to a client, testing webhooks from third party services, or collaborating with teammates, exposing a local development server to the internet often requires complicated networking, router configuration, or cloud deployments.

Ngrok solves this problem by creating secure tunnels between your local machine and the public internet. With just a single command, your application becomes accessible through a publicly available URL without changing your network configuration.

What Is Ngrok?

Ngrok is a secure tunneling platform that allows developers to expose locally running services over the internet. Instead of deploying your application to a cloud server for every test, Ngrok forwards incoming internet traffic directly to your local application.

For example, if your application runs on localhost:3000, Ngrok can generate a public HTTPS URL that forwards requests directly to your machine. Anyone with the URL can access your application while it continues running locally.

This makes Ngrok especially useful for development, debugging, demonstrations, and API testing.

How Ngrok Works

sddefault


Ngrok establishes an encrypted outbound connection from your computer to Ngrok's cloud infrastructure. Once the tunnel is created, external requests sent to the generated public URL are securely forwarded through that tunnel to your local application.

Since the connection originates from your computer, there is usually no need to modify firewall settings or configure port forwarding on your router.

The process is simple:

  1. Start your local application.
  2. Launch Ngrok and specify the local port.
  3. Receive a public HTTP or HTTPS URL.
  4. Share the URL or connect external services to it.

Installing Ngrok

Windows

  1. Download Ngrok from the official website.
  2. Extract the ZIP archive.
  3. Move ngrok.exe to a folder of your choice or add it to your system PATH.
  4. Open Command Prompt or PowerShell.

You can verify the installation by running:

Bash
ngrok version


macOS

Using Homebrew:

Bash
brew install ngrok/ngrok/ngrok


Verify the installation:

Bash
ngrok version


Linux

On Debian, Ubuntu, Kali Linux, and other Debian based distributions:

curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \
| sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null

echo "deb https://ngrok-agent.s3.amazonaws.com bookworm main" \
| sudo tee /etc/apt/sources.list.d/ngrok.list

sudo apt update

Bash
sudo apt install ngrok


Verify:

Bash
ngrok version

Creating an Ngrok Account

Although Ngrok can be installed without an account, creating one unlocks additional features and is recommended.

  1. Visit the Ngrok website.
  2. Create a free account.
  3. Log in to the dashboard.
  4. Copy your authentication token from the dashboard.

Connecting Your Account

Authenticate your local installation with your account using:

Bash
ngrok config add-authtoken YOUR_AUTH_TOKEN


Replace YOUR_AUTH_TOKEN with the token from your dashboard.

You only need to do this once on each computer.

Exposing Your Local Application

blog diagram k8s operator


Suppose your application is running on port 3000.

Start your application first.

Then open another terminal and run:

ngrok http 3000

Ngrok will display output similar to:

Forwarding https://abc123.ngrok-free.app -> http://localhost:3000

Anyone with that HTTPS URL can access your local application.

If your application uses another port, simply replace 3000 with the correct port.

Examples:

ngrok http 8080

ngrok http 5000

ngrok http 8000

Inspecting Requests

Ngrok includes a built in web interface for viewing every request sent through your tunnel.

Open your browser and visit:

http://127.0.0.1:4040

From this dashboard you can:

  • View request headers
  • Inspect request bodies
  • Inspect responses
  • Replay requests
  • Debug webhook events

This is especially useful when working with APIs and third party integrations.

Key Features

Secure Tunnels

Traffic between your computer and Ngrok is encrypted, helping protect your development environment.

HTTPS by Default

Every public URL includes HTTPS without requiring SSL certificate configuration.

Webhook Testing

Ngrok makes it easy to test webhooks from payment gateways, messaging platforms, authentication providers, and other APIs.

Traffic Inspection

Developers can inspect every incoming request, making debugging much faster.

Custom Domains

Paid plans allow custom domains for stable URLs and production style demonstrations.

Authentication and Access Control

Ngrok supports authentication, IP restrictions, OAuth, and additional security controls.

Common Use Cases

Ngrok is commonly used for:

  • Testing webhooks
  • API development
  • Sharing local applications
  • Client demonstrations
  • Mobile app backend testing
  • AI application development
  • IoT development
  • Remote debugging

Advantages

Ngrok provides several benefits:

  • Installation takes only a few minutes.
  • No router configuration is required.
  • HTTPS is available automatically.
  • Webhook testing becomes simple.
  • Built in request inspection saves debugging time.
  • Works across Windows, macOS, and Linux.

Limitations

The free plan generates temporary public URLs that change whenever you restart a tunnel.

Production environments usually benefit from paid plans that provide reserved domains, additional security, and higher usage limits.

Ngrok is designed primarily for development, testing, and demonstrations rather than replacing traditional production hosting.

Final Thoughts

Ngrok has become an essential tool for modern developers because it removes the complexity of exposing local applications to the internet. Whether you are testing APIs, debugging webhooks, demonstrating projects, or collaborating remotely, it allows you to share your local environment in seconds.

With an installation that takes only a few minutes and a single command to start a secure tunnel, Ngrok can quickly become one of the most valuable tools in your development workflow.