Auto Secure Login logoAuto Secure LoginPlatform Discord
Menu

ngrok Alternatives: How to Expose Localhost to the Internet Safely

Looking for an ngrok alternative? See how a localhost tunnel works, compare options from Cloudflare, Microsoft, Tailscale and self-hosted tools, and keep your local app safe.

Updated October 17, 2026

What a localhost tunnel does

An app on your computer usually listens on localhost. Only that computer can reach it. A localhost tunnel runs a small agent next to the app. The agent opens an outbound connection to a relay server that has a public address. Requests sent to the public URL travel down that connection to your local port. Your router never has to accept an incoming connection.

ngrok's own documentation describes a public URL that forwards traffic to your local machine. Authentication and IP restrictions are available through its Traffic Policy. The alternatives below differ in three ways: who runs the relay, how addresses are assigned and who can reach them by default.

A managed tunneling service runs that relay for you. With a self-hosted setup, you run it yourself. Many of these products started as a development tool for demos and webhook testing. Check their limits before you rely on one for something people use every day.

When you need to expose localhost to the internet, and when you don't

A tunnel is worth it when something outside your network must reach your machine:

  • Webhooks: payment, shipping and chat providers send events to a public HTTPS URL, not to localhost.
  • Demos: a client or teammate needs to try a build before you deploy it anywhere.
  • Remote testing: a tester on another network, or your phone on mobile data, needs the real app.

Sometimes you can skip the tunnel. For a phone on the same Wi-Fi, let your dev server listen on your local network. Then open your computer's local IP address on the phone. Vite's --host option does this. But it also listens on public addresses, so turn it off afterward. Testing Stripe webhooks? Stripe's webhook docs show stripe listen --forward-to localhost:4242/webhook for local testing without a public URL.

Security risks of exposing a local app

A tunnel lets anyone reach your app if they have the address, guess it or are sent it. Development setups are rarely built for that. Flask's documentation, for example, warns that its built-in debugger lets someone run any Python code from the browser. It must not run in production.

  • Weak or no login: local apps often skip sign-in. Or they use a test admin account with a weak password.
  • More exposed than you think: the tunnel exposes everything the app can reach. That includes admin pages, files, internal APIs and its database.
  • Secret links leak: a hard-to-guess URL is not access control. Links get forwarded, pasted into tickets and saved in browser history.
  • Forgotten tunnels: a tunnel left running keeps the door open long after the demo. So does a credential that never expires.
  • Unverified webhooks: Stripe notes that if you skip signature checks, an attacker could send fake events to your endpoint.

Before you share a link, turn debug mode off and use test data. Put a login or access rule in front of the app, and verify webhook signatures. Afterward, shut the tunnel down and revoke its credential.

Cloudflare Tunnel vs ngrok

Cloudflare Tunnel runs a lightweight background program (a daemon) called cloudflared. It makes outbound-only connections to Cloudflare. So your origin server needs no publicly routable IP address and no inbound listener. Like ngrok, it relies on an agent that dials out. The differences are in setup and access.

  • Quick Tunnels: cloudflared tunnel --url http://localhost:8080 creates a temporary trycloudflare.com address. You need no Cloudflare account or domain. The Quick Tunnels page says the hostname changes each time. It also says they are for testing and development, with a cap of 200 in-flight requests, no Server-Sent Events and no promised uptime.
  • Named tunnels: to publish on your own hostname, add a domain to Cloudflare. Then create a published application route. Cloudflare's setup guide notes that anyone on the internet can then reach the app, unless you add more controls.
  • Access control: add the app to Cloudflare Access to put a sign-in in front of it. Visitors then sign in through an identity provider. ngrok offers its own controls, such as OAuth and IP restrictions, through Traffic Policy.

Other ngrok alternatives: Microsoft dev tunnels and Tailscale Funnel

  • Microsoft dev tunnels: the devtunnel command-line tool shares a local port (devtunnel host -p 8080). First you sign in with a Microsoft, Microsoft Entra ID or GitHub account. Microsoft's overview says tunnels are accessible only to you by default. It labels the feature a public preview for ad hoc testing and development, not production.
  • Tailscale Funnel: if your devices already use Tailscale, tailscale funnel 3000 routes traffic from the internet to a local service. Tailscale's Funnel docs set several conditions. Funnel requires MagicDNS, HTTPS certificates and a policy attribute. It allows only ports 443, 8443 and 10000 over TLS. It applies bandwidth limits that you cannot configure, and it uses ts.net names. Check that page for its current release status.

Funnel is public to anyone with the address. To share only with your own devices or team, Tailscale points to Tailscale Serve instead.

Self-hosted ngrok alternatives

If you would rather not route traffic through a tunnel company, run the relay yourself. You need a server with a public address, such as a small cloud virtual machine. Open-source tools cost nothing to download. But updates, TLS certificates, logins and logs become your job.

  • SSH remote forwarding: ssh -R 8080:localhost:3000 you@your-server makes port 8080 on the server forward to port 3000 on your machine. The OpenSSH manual notes that, by default, the server binds that port to loopback only. So add a reverse proxy on the server for HTTPS.
  • frp: the open-source frp project (Apache-2.0) is a reverse proxy. It exposes a local server that sits behind NAT or a firewall. Its server (frps) runs on the public machine. Its client (frpc) connects out from yours. It supports TCP, UDP, HTTP and HTTPS.
  • A VPN back to your network: if only known people need access, a private VPN avoids public exposure. It does need software on each device.

If you want a hosted relay with named, private-by-default tunnels instead, ASL Tunnel is described at the end of this guide.

Port forwarding vs a tunnel

Port forwarding is a router rule. It sends incoming traffic on one port straight to your computer. Your computer then becomes reachable at your public IP address. Nothing sits in the middle, so HTTPS, logins and updates are all up to you. That address can also change.

Many mobile and some home connections use carrier-grade NAT. It shares one public address among many customers. Check your router's WAN address. If it is in 100.64.0.0/10, a port forward will not make you reachable from the internet. That range is the shared address space defined in RFC 6598 for this purpose. A tunnel works either way, because it connects from your side.

The trade-off is trust. A hosted tunnel's relay carries your traffic, so check what each provider stores and for how long.

Checklist for choosing an ngrok alternative

  • Traffic type: web only, or also TCP, UDP, WebSockets or Server-Sent Events? If you need UDP, confirm the service supports it. Also check whether it offers TLS tunnels that pass encrypted traffic through untouched.
  • Address: random and temporary, or stable and on your own domain? Webhooks and shared links need a stable one.
  • Default access: is a new tunnel public or private, and what sign-in, key or IP rules can sit in front of it?
  • Control: can you pause or revoke access at once, and is there a record of who changed what?
  • Data handling: who runs the relay, what it logs and where it runs.
  • Published limits: request caps, bandwidth limits, uptime commitments and release status.
  • Your app: does it need its own hostname, or can it run under a sub-path?
  • Cost: read each vendor's current pricing page yourself, because plans change.
  • Free tier and paid plan: what does the free tier limit, such as bandwidth, connections or custom domains? And what does a paid plan add? Check the vendor's current pricing page, because plans change.
  • Private access: can you require a sign-in? Or can you keep the app off the public internet, reachable only from your own devices? One example is the Tailscale client installed on each device.

How to choose: hosted tunnel, self-hosted tunnel, VPN or reverse proxy

Most ngrok alternatives fall into four groups. The right one depends on three questions. Who needs access? For how long? And how much upkeep can you take on?

  • Hosted tunnel: a company runs the relay, and you run a small agent. It is usually the quickest way to get a public HTTPS address. In return, you trust the provider with your traffic and accept its limits. It suits webhooks, quick demos and short tests.
  • Self-hosted tunnel: you run the relay on your own server, with SSH forwarding or a tool such as frp. You control the domain and the logs. You also patch the server, renew certificates and watch for abuse. It suits teams that do not want their traffic to pass through a third party.
  • VPN or mesh network: each device joins a private network, for example with WireGuard, OpenVPN or Tailscale. Nothing is public, so only enrolled devices can connect. Each device needs client software and has to be set up first. It suits remote admin, home labs and small teams.
  • Reverse proxy on a server: deploy the app to a staging server behind a reverse proxy such as nginx or Caddy. This is not a tunnel at all. It takes more setup, but your laptop no longer has to stay on. It suits anything that must run for days.

A simple rule of thumb helps. If the visitor is a machine, such as a webhook sender, use a stable public address and check signatures. If the visitors are people you know, prefer private access with a sign-in. If the app must stay up all the time, move it to a server.

Common uses for an ngrok alternative, and which type fits

The same tool is rarely right for every job. Here is how common uses map to the four types above:

  • Webhook testing: a hosted or self-hosted tunnel with a stable address. You then register the URL with the provider once, not every session. Some providers offer a command-line tool that forwards events to localhost instead, as the Stripe example above shows.
  • Client demo: a temporary tunnel with a sign-in or access rule, shut down after the meeting. For a demo that runs for days, a staging server is easier to keep up.
  • Mobile app testing: point a test build at a tunnel address for your local API. Use a stable address if you share the build, so you do not have to rebuild the app for each new URL.
  • IoT and home devices: reach cameras, sensors and home servers over a VPN or mesh network, not a public URL. Many of these devices have weak default settings and get few updates.
  • Remote admin: keep SSH, remote desktop and database ports off public URLs. Use a VPN or mesh network with multifactor sign-in. These services are common targets of password-guessing attacks.
  • Sharing with a teammate: if you are both on the same private network, share the app there. Otherwise, use a private tunnel that requires a sign-in.
  • Home apps for family or friends: photo, file and media servers hold personal data. Share them over a VPN or mesh network, or behind a tunnel that requires a sign-in.

Revisit the choice when a test turns into something people depend on. Daily use usually calls for a real server, monitoring and a plan for outages.

Security checklist before you share a local service

The risks above come down to a few habits. Run through this list every time you open a tunnel, not just the first time:

  • Sign-in at the edge: prefer a sign-in that the tunnel or a proxy enforces before requests reach your app. Then a bug in the app's own login cannot expose it. OWASP's Authentication Cheat Sheet covers the basics.
  • One port, one app: point the tunnel at the single port you need. Make the app listen only on localhost, so it is not also open to everyone on your local network.
  • Short-lived access: use links, tokens or tunnels that expire on their own. Set a reminder to close anything that has to stay open.
  • Request logs: record the time, source address, path and status code of each request, and read them after a demo. OWASP's Logging Cheat Sheet lists what to record and what to keep out, such as passwords and tokens.
  • Rate limits: limit requests to sign-in pages and APIs. Then a guessing attack or a runaway script cannot flood your machine.
  • Separate secrets: give the exposed app test API keys and a test database, never production credentials.
  • Replay protection for webhooks: besides checking the signature, reject events with old timestamps or repeated IDs. Then a captured request cannot be sent again.
  • Updates: the tunnel agent and any self-hosted relay face the internet. Update them like any other server software.

For a quick test with fake data, the first three items may be enough. Once real people, real data or real keys are involved, use the whole list.

Testing a webhook locally, step by step

Testing a webhook takes more than opening a tunnel. The flow below works with most providers that send events over HTTPS, whichever ngrok alternative you use. Names differ from one provider to the next, so follow your provider’s own guide at each step.

Start in the provider’s test or sandbox mode, if it has one. Create a new endpoint that points at your tunnel address plus the route your app handles, such as /webhooks/orders. Subscribe only to the events you are testing. The provider then shows a signing secret for that endpoint. Store it in a local environment variable, not in your code. Never reuse a production secret.

Next, write the signature check before any business logic. Many providers sign the exact bytes they send. So compute the signature over the raw request body, before your framework parses or reformats the JSON. A common bug is checking a re-encoded copy, which fails even for real events. Compare signatures with a constant-time function, and log any failure. GitHub’s guide to validating webhook deliveries shows one way to do this.

Then decide how your endpoint answers. Many providers treat a slow reply or an error status as a failed delivery and try again later. Others leave it to you to resend failed deliveries. A good habit is to check the signature, save the event, reply with a success status at once, and do the slow work afterward. GitHub’s webhook guidance describes this pattern. Your provider’s documentation says how long it waits and how retries work.

Plan for duplicates. A retry, a network hiccup or a manual resend can deliver the same event twice. Record each event ID when you first process it. If the ID comes back, reply with success and skip the work, so nobody is charged or emailed twice. This differs from the replay check above. A genuine duplicate gets a success reply, so the provider stops retrying.

Do not assume events arrive in order, either. An update can arrive before the event that created the record. Check the current state of the record before you act on an event.

Test the unhappy paths while the tunnel is open. Many providers can send a sample event or resend a past one from their dashboard or command-line tool. Try a wrong secret, a slow handler and the same event twice. Then read your request log to confirm that each case behaves as planned.

When you finish, close the tunnel. Then disable or delete the test endpoint in the provider’s dashboard. Otherwise it keeps sending events to an address that may later point somewhere else. If the signing secret was shared or pasted anywhere, rotate it.

Finally, move the handler to staging. Deploy it to a server with its own stable HTTPS address, and register a new endpoint for that address. Keep test, staging and production endpoints apart, each with its own secret. Run the same checks again there before you send live events to the code.

Where ASL Tunnel fits

ASL Tunnel is an early-access service for reaching an app on your own machine without opening a port in your firewall. A small program (Windows, Linux or Raspberry Pi) dials out and holds the connection. Your app gets a stable address under a name you reserve. That name is never reissued to anyone else.

New tunnels are private. Visitors need the access link you hand out. After that, their browser holds a signed pass for that address, valid for up to eight hours. You can make a tunnel public on purpose, for example for a webhook provider that cannot carry a key. Pausing or revoking a tunnel drops the live connection at once.

The product page states its limits. It carries web and app traffic only (no remote desktop, direct database access or raw network protocols). Apps are served under a sub-path of a shared address. The relay is run by ASL rather than self-hosted, and it runs in one location without automatic failover. Accounts are set up directly with ASL, not through self-serve signup. Pricing is quoted after a conversation. See how ASL Tunnel works and its full list of limits.

Frequently asked questions

Which ngrok alternative should I use?

It depends on the job. You may need a quick temporary demo, access limited to your own account, sharing within an existing Tailscale network, or full control on your own server. Use the checklist above to compare the options in this guide.

Is there a free ngrok alternative?

Cloudflare says its Quick Tunnels need no account or domain. Open-source tools such as OpenSSH and frp cost nothing to download, though self-hosting needs a server with a public address. Prices change, so check each vendor's own pricing page.

Is it safe to expose localhost to the internet?

It can be, briefly and with care. Turn off debug modes, use test data, require a login or access rule, verify webhook signatures and close the tunnel when you are done.

What is the difference between Cloudflare Tunnel and ngrok?

Both use an agent that connects outward, so no inbound port is needed. Cloudflare offers account-free Quick Tunnels and named tunnels on your own domain. You can protect the named tunnels with Cloudflare Access. ngrok gives a public URL with Traffic Policy controls.

Can I self-host an ngrok alternative?

Yes. Use SSH remote forwarding or frp with a server that has a public address, plus a reverse proxy for HTTPS. You then maintain the server, certificates, logins and logs yourself.

How do I expose a local server to the internet without a tunnel?

Port forwarding on your router works if your connection has its own public IP address. But it exposes your machine directly, and it fails behind carrier-grade NAT. For a phone on the same Wi-Fi, a dev server listening on your local network is usually enough.

Related guides

Explore the complete product

Read features, current access and limitations

Help / Ayuda