· NGSRV Team

How to expose localhost:5173 to the internet

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

Vite's default port since v3. Most React and Vue projects land here. The tunnel does not care what framework you run. It forwards HTTPS to whatever is bound on 5173.

Quick start

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

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

What usually runs on 5173

  • Vite
  • Vue 3 dev server

Typical dev command: npm run dev

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

ngsrv http 5173

Sample output:

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

Stable subdomain (optional)

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

ngsrv http 5173 --subdomain vite-preview
# -> https://vite-preview.tnl.ngsrv.com

Host header gotcha

Vite may reject requests when the Host header does not match localhost.

Add the ngsrv hostname to server.allowedHosts in vite.config.ts, or set server.allowedHosts: true during local preview work.

When it breaks

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