· NGSRV Team

How to expose localhost:4242 to the internet

You have something listening on port 4242 and need a link you can paste into Slack, a webhook dashboard, or your phone. This is the copy-paste path.

Stripe's official samples often use 4242. Handy when you want a port that is obviously for webhooks. The tunnel does not care what framework you run. It forwards HTTPS to whatever is bound on 4242.

Quick start

curl -fsSL https://get.ngsrv.com | bash
ngsrv token <YOUR_TOKEN>
ngsrv http 4242

You get a public URL like https://furry-otter-1842.tnl.ngsrv.com that routes to http://localhost:4242.

What usually runs on 4242

  • Stripe webhook sample apps
  • custom webhook handlers

Typical dev command: node server.js

Install the CLI

# macOS (Homebrew)
brew install ngsrv/tap/ngsrv

# macOS / Linux
curl -fsSL https://get.ngsrv.com | bash

# Windows (PowerShell)
irm https://get.ngsrv.com/windows | iex

Sign up at ngsrv.com/register if you need a token. Free tier, no card.

Run the tunnel

With your server already up on port 4242:

ngsrv http 4242

Sample output:

forwarding  https://furry-otter-1842.tnl.ngsrv.com -> http://localhost:4242
status      online

Stable subdomain (optional)

Random names change when you restart. For webhooks or client previews, reserve one:

ngsrv http 4242 --subdomain hooks
# -> https://hooks.tnl.ngsrv.com

When it breaks

connection refused — Nothing is listening on 4242. Confirm with lsof -i :4242 (macOS/Linux) or netstat -ano | findstr :4242 (Windows).

401 invalid token — Re-run ngsrv token <YOUR_TOKEN> from the dashboard.

Tunnel drops — ngsrv reconnects on its own. Persistent drops usually mean VPN or proxy interference.