· engineering
Verify Your Local Server Before Opening an HTTPS Tunnel
Start your local dev server on port 3000, verify localhost access first, then expose it over a secure HTTPS tunnel for webhooks, previews, and mobile testing.
By InstaWormhole team, Engineering

Start your local server on a known port (such as 3000) and confirm it loads locally before you open an HTTPS tunnel. This prevents a wide class of connection failures, blank pages and misleading upstream errors. A tunnel forwards public HTTPS requests to a service on your own machine, so it can only pass along what that service already serves. If nothing is listening on the expected port, the server is bound to the wrong interface, or the app returns an error locally, the tunnel cannot fix it.
A quick local check separates application bugs from tunnel configuration issues from the start of your workflow. InstaWormhole’s own Quick Start follows the same order: its first step is to open your app on your own computer, and it notes that if the page does not load, you should fix that first, because the tunnel can only forward what your app already serves.
Why Local Verification Matters Before Tunneling
A request through a public tunnel crosses several layers: DNS, TLS, the tunnel’s routing, and finally your local app. If something breaks, diagnosing all of those layers at once wastes time. Verifying locally first gives you a clean baseline:
- You confirm the process is actually running. Build scripts, migrations and environment checks can fail or exit before the server binds a port.
- You verify the exact port number. Some dev servers move to another port when the default is taken. Vite’s documentation, for example, says it tries the next available port if the configured one is in use, so the port it ends up on may not be the one you expected.
- You catch local startup errors early. Missing
.envvariables, database connection errors and syntax errors show up when you hit the local endpoint directly. - You distinguish application issues from tunnel issues. If
http://localhost:3000returns a500 Internal Server Erroror refuses connections, the problem is in your app or its startup, not in the tunnel.
Always confirm that your local server returns the expected response on
localhostbefore connecting a tunnel to that port.
Step 1: Start Your Local Server on a Known Port
Most frameworks have a default port, but passing one explicitly removes guesswork when you later point a tunnel at it.
Common Framework Startup Commands
| Framework or Runtime | Default Port | Explicit Port Command |
|---|---|---|
| Next.js | 3000 | npx next dev -p 3000 |
| Vite | 5173 | npx vite --port 3000 |
| Express / Node.js | None (set in code) | PORT=3000 node server.js |
Python (http.server) | 8000 | python3 -m http.server 3000 |
| FastAPI (Uvicorn) | 8000 | uvicorn main:app --port 3000 |
| Flask | 5000 | flask run --port 3000 |
| Ruby on Rails | 3000 | bin/rails server -p 3000 |
| PHP built-in server | None (address and port required) | php -S localhost:3000 |
| Laravel Artisan | 8000 | php artisan serve --port=3000 |
The PORT=3000 form for Express only works if your code reads process.env.PORT, and the prefix syntax is for macOS and Linux shells. In Windows PowerShell, set the variable first with $env:PORT = 3000.
When the server starts, read the terminal output for a line showing the host and port, such as Listening on http://localhost:3000 or a Local: line from Vite.
Watch for Silent Port Bumping
If an old background process is still holding port 3000 and your dev server moves to 3001, a tunnel pointed at 3000 will forward public traffic to the stale process instead of your current project. Read the startup log and make sure the printed port matches the port you intend to tunnel. Vite also offers server.strictPort, which makes it exit instead of choosing another port.
Step 2: Verify the Server Loads Locally
Once the terminal says the server is running, confirm it serves a valid response. Use curl, a browser, or both.
Test With curl in a Second Terminal
curl shows status codes, headers and bodies without browser caching getting in the way:
curl -i http://localhost:3000The -i flag prints the status line and response headers along with the body. Check three things:
- Status code:
200 OK, or an expected redirect such as302 Foundor307 Temporary Redirect. - Content-Type header:
text/htmlfor pages,application/jsonfor JSON APIs. - Response body: The markup or JSON you expect from this application.
If your app exposes a health check or webhook endpoint rather than a root route, test that path directly:
curl -i http://localhost:3000/api/healthFor a webhook endpoint that only accepts POST, send a small test payload:
curl -i -X POST http://localhost:3000/webhooks/stripe \
-H "Content-Type: application/json" \
-d '{"type":"ping"}'A 2xx response locally shows that your route accepts requests and responds. Real providers may also require valid signatures, so a local test like this does not guarantee they will accept the endpoint.
Test in a Local Web Browser
For frontend and full-stack apps, open http://localhost:3000 and check the developer console and Network tab:
- Confirm the page renders. A single-page app can return
200 OKforindex.htmlwhile its JavaScript bundles fail to load. - Check for failed assets. CSS, scripts and initial API calls should resolve with successful status codes such as
200or304. - Check hot reload. Dev servers use a WebSocket for hot module replacement (HMR), and confirming it works locally makes later problems easier to isolate.
Step 3: Check Which Network Interface Your Server Binds To
A server can load in one local test and still fail for another client because of the address it listens on.
Understanding Loopback Addresses vs. All Interfaces
127.0.0.1: The IPv4 loopback address. It accepts connections only from the same machine.::1: The IPv6 loopback address. It also accepts connections only from the same machine.localhost: A hostname that your system resolves to127.0.0.1,::1, or both, depending on the hosts file and resolver.0.0.0.0and::: Wildcard addresses that listen on all IPv4 or IPv6 interfaces, including loopback and your LAN addresses. Whether::also accepts IPv4 depends on the operating system and server settings.
The IPv4 vs. IPv6 Mismatch Problem
When localhost resolves to more than one address, the address a client tries first may not be the one your server listens on. Vite’s documentation notes that when you access localhost, the browser’s DNS resolution may differ from the address Vite is listening on, and that Node.js versions before 17 reorder resolved addresses by default.
Suppose a server binds only to 127.0.0.1:3000. Requests to http://127.0.0.1:3000 work, while a client that connects to [::1]:3000 is refused. The reverse also happens: a server bound only to ::1 will refuse a client that connects to 127.0.0.1. If you suspect a mismatch, test both loopback addresses:
curl -i http://127.0.0.1:3000
curl -i "http://[::1]:3000"If one succeeds and the other is refused, bind the server to an explicit address. With Vite, npx vite --host 127.0.0.1 --port 3000 does this, and with Uvicorn so does uvicorn main:app --host 127.0.0.1 --port 3000.
Step 4: Verify the Listening Port at the OS Level
If curl reports Connection refused, ask the operating system what is actually listening on port 3000.
Check Listening Ports on macOS and Linux
lsof -iTCP:3000 -sTCP:LISTEN -n -PThe -n and -P flags skip DNS and port-name lookups. The output shows the command, PID and bound address, such as 127.0.0.1:3000, *:3000 or [::1]:3000.
On Linux systems without lsof, use ss:
ss -tlnp | grep :3000Check Listening Ports on Windows
In PowerShell:
Get-NetTCPConnection -LocalPort 3000 -State ListenOr with netstat, which works in Command Prompt or PowerShell:
netstat -ano | findstr :3000If these commands print nothing, nothing is listening on port 3000. The server may still be compiling, it may have crashed on startup, or it may have bound to a different port.
Common Local Server Failures and How to Fix Them
EADDRINUSE or “Address already in use”
Another process already holds the port. Common culprits include:
- An orphaned dev server in a forgotten terminal tab or background session.
- A Docker container publishing
-p 3000:3000. - A previous test run or service that did not exit cleanly.
Find the PID with the commands from Step 4, confirm it is safe to stop, and end it. Or start your server on a free port such as 3001 or 8080 and use that port consistently from then on.
Connection refused on localhost:3000
When curl reports that it failed to connect to localhost port 3000, check these causes in order:
- The server is still starting. Large TypeScript, webpack or Rust builds can take a while before the socket opens. Wait for the ready message.
- The server crashed after launch. Look for stack traces, missing environment variables or database errors in the server terminal.
- Wrong port or interface. Check the startup log, and use the loopback tests above to rule out an address-family mismatch.
Local HTTPS vs. Plain HTTP
Most dev servers serve plain HTTP by default, such as http://localhost:3000. Plain HTTP is also the simplest option for tunneling, because the tunnel provides the public HTTPS address. InstaWormhole’s troubleshooting guide states that a local server that only accepts HTTPS is not supported, so if you enabled a self-signed certificate locally, switch the local server back to plain HTTP before you tunnel it.
Blocked Hosts and Origins in Dev Servers
A dev server may work at http://localhost:3000 and still refuse requests that arrive under a public tunnel hostname. Two common cases:
- Vite restricts which host names it responds to through
server.allowedHosts. By default it allowslocalhost, domains under.localhost, and all IP addresses, so a public tunnel hostname must be added explicitly. Vite warns against setting the option totrue, because that allows any website to reach your dev server through DNS rebinding attacks, and recommends an explicit list of hosts. - Next.js (version 15 and later, per InstaWormhole’s framework guide) blocks development assets requested from other origins, which breaks hot reload and hydration. The fix is
allowedDevOriginsinnext.config.js.
Once your server loads cleanly on localhost, add your tunnel’s hostname to the relevant setting before you share the link.
Pre-Tunnel Local Verification Checklist
Run through this four-point check before you start the tunnel:
- Process active: The server terminal shows a running process with no startup crash or fatal build error.
- Exact port confirmed: You know the TCP port from the startup log or from
lsof,ssorGet-NetTCPConnection. - Loopback interface verified:
curl -i http://localhost:3000orcurl -i http://127.0.0.1:3000returns the expected status code and body. - Target routes tested: Any API paths, health checks or webhook endpoints you plan to use externally respond properly on your machine.
Next: Open the Tunnel With InstaWormhole
With the local checks passing, you can connect the verified port. InstaWormhole’s Quick Start lists Node.js 20 or later for the npx command, and it works on Windows, macOS and Linux. The steps are:
- Create a tunnel in the dashboard.
- Sign this computer in once.
- Run the connect command that the dashboard gives you.
Signing in uses this command:
npx @instawormhole/connector loginThe connect command from the dashboard looks like this, with <tunnel id> filled in for you:
npx @instawormhole/connector run --relay wss://relay.instawormhole.site --origin 127.0.0.1:3000 --stored-device --tunnel <tunnel id>Change 3000 to your app’s port if it is different. The --origin value is the local address the connector forwards to, so confirm that your server answers on 127.0.0.1 at that port. Your public address ends in .instawormhole.site. By default it answers anyone on the internet unless you protect it, so choose who may visit when you create the tunnel.
If the Public Address Fails
Because you already verified the local server, most failures can be matched quickly. InstaWormhole’s troubleshooting guide lists these causes:
- 404 with no page: No connector is serving the address. Start the connector with the command from Connect an app, and resume the tunnel if it is paused. A connector started with only a port creates a temporary address that changes each time.
- 502 or 503: The connector is connected but could not reach your app. Make sure the app is running and that
--originmatches its port, for example127.0.0.1:3000. - Page loads but looks unstyled, or says Blocked request: Your dev server may be refusing the tunnel’s address. Use the framework settings described above.
In the dashboard, Tunnel Doctor checks each layer and names the one that failed. Its diagnostic codes include ORIGIN_UNREACHABLE, which means your app is not reachable at the --origin address, and CONNECTOR_UNAVAILABLE, which means the connector is recorded as connected but did not take the request. For CONNECTOR_UNAVAILABLE the documented fix is to restart the connector with Ctrl+C and then the command from Connect an app.
When your local checks and the tunnel agree, any remaining problem is much easier to find.