· engineering

Debug Streaming AI Responses Over an HTTPS Tunnel

Forward streaming responses from local LLM backends through a public .instawormhole.site HTTPS URL and inspect headers and timing in Request Inspector.

By InstaWormhole team, Engineering

Debug Streaming AI Responses Over an HTTPS Tunnel

Debugging streaming AI responses, such as token-by-token completions from a local LLM backend or an API proxy, gets harder once you need to test from outside localhost. Phones, remote webhooks, third-party integrations and external collaborators all need a reachable HTTPS endpoint. You also need to see how requests arrive, which headers pass through and how long each call takes.

InstaWormhole exposes a local app on a public .instawormhole.site HTTPS address. Its connector forwards WebSocket and streaming responses, and its request inspector records what reaches each tunnel. This guide shows how to use both with a local streaming AI backend. Every product detail comes from the InstaWormhole documentation.

Why Streaming AI Endpoints Need a Tunnel and an Inspector

A backend serving streaming completions on http://localhost:3000 is unreachable from a phone on cellular data, a teammate’s laptop or an external service. A tunnel fixes that without any router or firewall changes. According to the docs, the connector connects out to InstaWormhole, so you do not open a port or change your firewall for incoming traffic.

Streaming adds a few debugging problems that a single JSON response does not have:

  • Long-lived responses: The connection stays open while output is produced, so a slow or stuck stream looks different from a failed request.
  • Header-dependent behavior: Content type, authorization and custom headers decide how a client and server negotiate a stream.
  • Who answered: When a call fails, you need to know whether your app produced the error or InstaWormhole did.
  • Repeatability: Reproducing a bad prompt payload is faster when you can resend a captured request instead of rebuilding it by hand.

How a Request Reaches Your Local App

A visitor opens your tunnel address over HTTPS and the request reaches InstaWormhole’s edge. The edge checks the tunnel’s rules: whether it is blocked, its request limits, its IP list and its password or token. A request that passes goes through the relay to your connector, over the connection the connector opened. The connector hands it to your app and returns the answer along the same path.

The docs state that WebSocket and streaming responses are forwarded. The connector only forwards to loopback addresses such as 127.0.0.1, localhost and ::1. Your app must answer plain HTTP, because a local server that only accepts HTTPS is not supported.

There are two kinds of address:

  • Durable tunnel: You create it in the dashboard and connect with its tunnel id. The address stays the same across reconnects, sleep and network changes, and the request inspector records its traffic.
  • Quick address: You get a temporary random address by running the connector with only a port. Quick addresses are not recorded by the inspector.

For the debugging workflow below, use a durable tunnel.

Prerequisites

  • A working local service: Start your LLM backend or API server and confirm it answers on your own machine first. The tunnel can only forward what your app already serves.
  • A supported computer: The connector is published for Windows (x64), macOS (Apple silicon and Intel) and Linux (x64 and arm64). The npx command needs Node.js 20 or later, and you can download the connector instead if you prefer. The docs call for connector 0.2.0 or later.
  • An account: You can sign up with GitHub, Google, an email address or a passkey. The Free plan needs no payment details. GitHub and Google are used only to confirm who you are, and InstaWormhole does not ask for access to your repositories or code.

Forward a Local Streaming Backend

1. Create a Tunnel

In the dashboard, open Tunnels, choose Create tunnel and give it a name. Then pick an expiry: Never, In 1 hour, In 1 day, In 7 days or In 30 days.

Under Who can open it, choose Anyone with the address, or Only people with a password if your plan includes password protection (Starter and up). The public address, which ends in .instawormhole.site, answers anyone on the internet unless you protect it.

2. Sign In This Computer

Run this once on your development machine:

npx @instawormhole/connector login

The connector prints a short code and a web address. Open the address, check that the request is from your computer and approve it. You can confirm the result at any time:

npx @instawormhole/connector status

If login cannot save the sign-in, run npx @instawormhole/connector doctor. It checks the credential store and whether the service answers, and says what to fix.

3. Connect the Tunnel to Your Port

On your tunnel in the dashboard, open Connect an app and choose Copy command. Change 3000 to your backend’s port if it differs:

npx @instawormhole/connector run --relay wss://relay.instawormhole.site --origin 127.0.0.1:3000 --stored-device --tunnel <tunnel id>

The dashboard fills in your tunnel id. Keep the window open while you want the tunnel live. The tunnel’s badge changes to Live within a few seconds. Stop the connector with Ctrl+C when you finish.

4. Test a Streaming Call From Outside

Send a streaming request to the public address from a device that is not on your network, such as a phone with Wi-Fi off, or from a terminal. The path and payload below are placeholders for whatever your own backend expects:

curl -N -X POST https://your-tunnel.instawormhole.site/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"local-model","messages":[{"role":"user","content":"Stream a short status update"}],"stream":true}'

The -N flag turns off curl’s output buffering so chunks print as they arrive. The docs say the connector forwards streaming responses as they are produced, which is what Streamable HTTP and server-sent events need. They also say InstaWormhole has not published a list of AI clients it has tested.

Protect an AI Endpoint Before You Share It

A model server can be expensive to run and may hold private context, so decide who can reach it before you share the link. Password protection, access tokens and IP allow and deny lists are included from the Starter plan.

Many AI clients cannot answer a browser password prompt, so the docs recommend an access token for them. The client sends the token as the X-InstaWormhole-Token header, or as a bearer token in the Authorization header. The tunnel checks the token and does not pass it on, so your server can keep its own authentication.

Frameworks and Dev Servers in Front of Your Backend

If a web frontend or dev server sits in front of your AI backend, the dev server may refuse the tunnel’s address. In the examples below, replace example with your own tunnel name. The docs list these settings:

  • Vite 6 and later: Add the address to server.allowedHosts and send hot reload over wss on port 443. Tunnel Doctor shows preview.allowedHosts for vite preview, and says that in Vite 8 the same keys sit under server.ws.
  • Next.js 15 and later: Add the address to allowedDevOrigins in next.config.js.
  • Expo: Run npx @instawormhole/connector 8081, then start Expo with EXPO_PACKAGER_PROXY_URL set to your tunnel address. This replaces expo start --tunnel.
  • Shopify CLI: Connect a tunnel to the app’s port, then run shopify app dev --tunnel-url https://example.instawormhole.site:443.
  • Laravel and PHP: Run npx @instawormhole/connector 8000, serve the app on port 8000 and set APP_URL in your .env file. In Laravel 11 and later, also trust the proxy in bootstrap/app.php.

A Vite configuration looks like this:

export default {
  server: {
    allowedHosts: ['example.instawormhole.site'],
    hmr: { protocol: 'wss', clientPort: 443 },
  },
}

For Next.js:

module.exports = {
  allowedDevOrigins: ['example.instawormhole.site'],
}

Inspect Requests

Open the tunnel in the dashboard and choose Open request inspector. The list shows requests newest first and refreshes itself while the page is open. Each row shows the method, the path, the status and the duration.

Select a request to see its detail:

  • The method and the path, with query values replaced so a token in the address is not stored.
  • The status, and who answered: your app, or InstaWormhole itself with a code.
  • The size and type of the request and the response, and the first part of the sender’s address, never the full address.
  • The request and response headers, with sensitive values replaced by redacted.

The inspector shows one duration per request. It does not break a stream into chunks or timestamp individual tokens, so measure per-token latency in your client or server logs. A few retention details matter when you debug:

  • A record is kept for 24 hours, and the inspector keeps the newest 500 requests of each tunnel. Pinned requests are not trimmed by the count but also expire after 24 hours.
  • A tunnel records at most 10 requests a second. Extra requests are counted as not recorded and do not slow the tunnel.
  • Requests refused by the password prompt, and requests for an unknown address, are not recorded.
  • You can filter by status class, method, path text and time, and you can add a note of up to 500 characters or pin a request.

What Is Redacted

The relay removes sensitive data before anything is stored, so a redacted value cannot be shown later. If a header shows redacted, that is the inspector’s behavior and does not mean the header never arrived. This matters for AI traffic, which often carries API keys. The docs list these rules:

WhatHow
Header values for authorization, proxy-authorization, cookie and set-cookieReplaced with redacted
Header names containing token, secret, password, session, api-key, apikey, auth or keyReplaced with redacted
Query string values in the pathReplaced; the keys stay
The sender’s full addressOnly the /24 for IPv4 or the /48 for IPv6 is kept

Request and Response Bodies

Bodies are off by default. Bodies are not redacted, which is why you have to turn capture on yourself. In the inspector, choose Keep bodies and confirm the dialog. New requests then keep up to the first 64 KiB of the request body and of the response body, for 24 hours. A long streamed completion may therefore be captured only in part.

Prompts and completions can contain secrets or personal data, so turn capture off again with Stop keeping bodies when you no longer need it. Bodies already stored stay until they expire, or until you delete the requests. Turning capture on or off needs a recent sign-in and is recorded in the workspace audit log.

Replay a Captured Request

After you fix a bug, select a captured request and choose Replay. A dialog shows the method, the path, the headers and, if it was kept, the body. You can edit them before you confirm. The docs list these limits:

  • The replayed request goes to the tunnel’s public address and your app, and it carries an X-Instawormhole-Replay header.
  • You can replay once every 5 seconds, and each replay is recorded in the workspace audit log.
  • Replay is not available on a tunnel with a password, and it is not offered for WebSocket requests.
  • Replaying a request that creates or changes something can do that again. A POST that triggers a paid model call may be billed twice.

To reuse a request elsewhere, choose Copy as cURL or Download HAR. Redacted values stay redacted in both, and a review step lists what was removed.

Diagnose Tunnel Problems

If your local app does not answer on its own port, fix that first. Then run Run Tunnel Doctor from the tunnel in the dashboard. It checks the layers in the order a request travels:

  1. Address lookup (DNS)
  2. Secure connection (TLS)
  3. Tunnel state
  4. Connector
  5. Access protection
  6. Your app
  7. Request through the public address

Start with the first layer marked as failing. Tunnel Doctor sends one GET request to the tunnel’s address from the InstaWormhole edge, so it is not an independent outside check. Your app receives it with an X-Instawormhole-Diagnostic header, which makes it easy to find in your logs. You can run it once every 10 seconds per tunnel.

Some diagnostic codes you are likely to meet:

CodeMeaningWho fixes it
CONNECTOR_OFFLINEThe connector is not running. Start it with the command under Connect an app.You
CONNECTOR_UNAVAILABLEThe connector is recorded as connected but did not take the request. Restart it.You
ORIGIN_UNREACHABLECheck that your app is running and that --origin matches its port.You
ORIGIN_SLOWYour app accepted the request but did not answer within 15 seconds.You
ORIGIN_NO_RESPONSEYour app closed the connection without a response. Check its logs.You
REQUEST_RATE_LIMITEDThe tunnel is getting more requests a minute than its plan allows.You
ROUTE_TRANSFER_LIMITThe workspace has used its monthly transfer allowance.You

Tunnel Doctor also recognizes development-server problems and shows the exact line to add: REQUEST_VITE_HOST_BLOCKED, REQUEST_VITE_PREVIEW_HOST_BLOCKED, REQUEST_NEXT_DEV_ORIGIN_BLOCKED and REQUEST_VITE_HMR_UNREACHABLE.

The ORIGIN_SLOW check applies to the Doctor’s own GET / request. Check how your own timeout settings behave with a slow first token before blaming the tunnel.

Plan Limits That Affect Streaming Tests

Two limits return HTTP 429:

  • Requests a minute per tunnel: When a tunnel gets more, the relay answers 429 until the minute passes.
  • Monthly transfer: When it is used up, tunnels answer 429 until the first of next month (UTC).

Streamed completions can move a lot of data, so check the transfer allowance before a long test run. On the Free plan a connection also lasts up to 24 hours. Paid plans have no session time limit. Prices are in US dollars before any sales tax or VAT, and yearly billing is 25% less than twelve months of monthly billing.

PlanPriceTunnels online at onceTransfer a monthRequests a minute per tunnelReserved addressesCustom domains
Free$035 GB1201None listed
Starter$4.99 a month, or $44.91 a year (about $3.74 a month)1050 GB60051
Pro$9.99 a month, or $89.91 a year (about $7.49 a month)25200 GB1,200103
Team$19.99 a month, or $179.91 a year (about $14.99 a month)50500 GB2,4002510
Business$39.99 a month, or $359.91 a year (about $29.99 a month)1001 TB4,8005025

Starter and higher plans include password protection, access tokens, IP allow and deny lists and webhook signature checks. They also include the webhook inbox, which holds requests for 24 hours on Starter and Pro and 72 hours on Team and Business.

Debugging Checklist

  • Confirm your backend answers on its local port before you start the connector.
  • Use a durable tunnel, because quick addresses are not recorded by the inspector.
  • Choose an expiry and an access setting before you share the link, and use an access token for AI clients that cannot answer a password prompt.
  • Update Vite, Next.js, Expo, Shopify CLI or Laravel settings if a frontend sits in front of the backend.
  • Read each request’s status, duration and who answered in the request inspector, and remember that redacted header values are the inspector’s doing.
  • Turn on body capture only while you need it, and remember it keeps at most the first 64 KiB of each body.
  • Use Replay to resend an edited request, unless the tunnel has a password or the request is a WebSocket.
  • Run Tunnel Doctor and check the 429 limits when requests fail or stop forwarding.