· NGSRV Team

How to expose localhost:3001 to the internet

Port 3001 is where your dev server lives right now. Here is how to put a public HTTPS URL in front of it without deploying.

Teams sometimes run a second frontend on 3001 when 3000 is already in use. The tunnel does not care what framework you run. It forwards HTTPS to whatever is bound on 3001.

Quick start

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

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

What usually runs on 3001

  • Next.js (alt port)
  • CRA when 3000 is taken

Typical dev command: npm run dev -- -p 3001

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 3001:

ngsrv http 3001

Sample output:

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

Stable subdomain (optional)

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

ngsrv http 3001 --subdomain web-alt
# -> https://web-alt.tnl.ngsrv.com

Host header gotcha

Same host-header rules as port 3000 for Next.js and Vite.

For Next.js, add the ngsrv hostname to experimental.allowedDevOrigins in next.config.js.

When it breaks

connection refused — Nothing is listening on 3001. Confirm with lsof -i :3001 (macOS/Linux) or netstat -ano | findstr :3001 (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.