· engineering

Connect a Custom Domain to a Localhost Tunnel

Point your own domain to a localhost HTTPS tunnel without migrating DNS. Test OAuth callbacks, webhooks, and custom subdomains locally with InstaWormhole.

By InstaWormhole team, Engineering

Connect a Custom Domain to a Localhost Tunnel

Exposing a local development server over HTTPS makes localhost reachable from the public internet. Every InstaWormhole tunnel gets a public address ending in .instawormhole.site. For quick previews, mobile testing or a first webhook test, that address needs no DNS setup.

Some work needs your app to live under a domain you own. Identity providers, webhook senders and browser security rules can all care which hostname they see. InstaWormhole lets you serve a tunnel on a domain you own, such as dev.example.com, by adding two DNS records at your existing DNS provider.

This guide covers when the built-in address is enough and when a custom domain helps. It also covers which plans include custom domains and how to connect one. Finally, it covers how to configure your dev server and keep the tunnel protected.

When .instawormhole.site Is Enough vs. When You Need a Custom Domain

Every tunnel gets a public HTTPS address ending in .instawormhole.site. All plans, including Free, can reserve a name for that address so it stays the same and is easy to read. Free includes 1 reserved address.

The built-in address is usually enough for:

  • Device and cross-network previews: Open the address on a phone with Wi-Fi turned off to check layouts and touch interactions.
  • Client and teammate reviews: Share a work-in-progress build and choose who can open it, for example with a password (Starter and up).
  • Early webhook prototyping: Use it when the sender accepts any HTTPS URL.

A custom domain starts to matter when something outside your control cares about the hostname.

Callbacks and Allowlists

OAuth 2.0 and OpenID Connect providers match redirect URLs against the ones you register. Webhook senders and partner integrations may also ask you to allowlist or verify the domain they call. Policies differ by provider, so check your provider’s documentation. If it expects a domain your organization owns, a subdomain such as dev.example.com fits that expectation better than a third-party hostname.

Cookies and Cross-Origin Behavior

Browsers decide whether two hosts are the same site by their registrable domain. If your frontend runs on app.example.com and calls a backend on a .instawormhole.site address, those are different sites. A cookie scoped to .example.com is not sent to the .instawormhole.site host, and SameSite rules apply to the cross-site request.

If the tunnel is served from dev.example.com instead, it shares a registrable domain with your other subdomains, so it is same-site. Note that sibling subdomains are still different origins, so CORS rules still apply. The benefit is that your local setup can mirror your production hostnames and cookie domains.

Your Existing DNS Stays Where It Is

You do not move your nameservers or hand over your DNS zone. You add two records for one hostname at your existing DNS provider and leave everything else alone.

Side-by-Side Comparison

Requirement.instawormhole.site addressCustom domain (dev.example.com)
DNS setupNoneA TXT record and a CNAME record at your DNS provider
Quick mobile and external testingWorks immediatelyWorks, but more setup than a one-off check needs
Hostname seen by third partiesA .instawormhole.site nameA name under your own domain
Same-site cookies with your other subdomainsNoYes
PlanAll plans (Free includes 1 reserved address)Starter and higher

Plans and Limits for Custom Domains

Custom domains start on the Starter plan, which costs $4.99 a month or $44.91 a year (about $3.74 a month). The table below comes from InstaWormhole’s plans and limits page. Prices are in US dollars before any sales tax or VAT added at checkout.

PlanPriceCustom domainsReserved addressesTunnels online at onceTransfer a monthRequests a minute per tunnel
Free$00135 GB120
Starter$4.99/month or $44.91/year151050 GB600
Pro$9.99/month or $89.91/year31025200 GB1,200
Team$19.99/month or $179.91/year102550500 GB2,400
Business$39.99/month or $359.91/year25501001 TB4,800

A few details from the same page matter for custom-domain work:

  • On Free, a connection lasts up to 24 hours. Paid plans have no session time limit.
  • When a tunnel gets more requests per minute than its plan allows, the relay answers 429 until the minute passes. When monthly transfer is used up, tunnels answer 429 until the first of the next month (UTC).
  • Password protection, access tokens, IP allow and deny lists and webhook signature checks are included from Starter.
  • The webhook inbox is included from Starter. It holds requests for 24 hours on Starter and Pro and 72 hours on Team and Business.

How to Connect Your Own Domain to a Tunnel

The full procedure is in the Connect your own domain to a tunnel guide, which InstaWormhole estimates at about 15 minutes plus DNS propagation. Before you start you need:

  • A durable tunnel.
  • A plan with a free custom domain slot (see the table above).
  • Control of the domain’s DNS, because you add two records there.

One domain points at one durable tunnel.

Step 1: Get a Working Tunnel First

A tunnel can only forward what your app already serves, so confirm the app works locally and the tunnel is live before adding a domain.

  1. Start your app and open it on your own computer, for example at http://localhost:3000.
  2. In the dashboard, open Tunnels, choose Create tunnel, name it and pick an expiry: Never, In 1 hour, In 1 day, In 7 days or In 30 days.
  3. Under Who can open it, choose Anyone with the address, or Only people with a password if your plan includes password protection.

The connector needs Node.js 20 or later for the npx commands. Sign your computer in once:

npx @instawormhole/connector login

The terminal prints a short code and a web address. Open the address, approve the request only if you started it, and check the result:

npx @instawormhole/connector status

Then open Connect an app on your tunnel, choose Copy command, and run it. Change 3000 to your app’s port if needed:

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. When the tunnel’s badge changes to Live, the local port, connector and relay path are working.

Step 2: Pick a Dedicated Hostname

Choose a hostname that exists only for tunneling instead of pointing your main domain at your laptop. Some examples:

  • dev.example.com for general development
  • webhooks-dev.example.com for provider callbacks
  • alice-dev.example.com for one developer’s environment

The docs say that for a domain without a subdomain (an apex), you use the A record addresses the dashboard shows instead of a CNAME. A dedicated subdomain avoids that and keeps your root domain’s records untouched.

Step 3: Add the Domain and Create Two DNS Records

  1. In the tunnel’s settings, choose Add domain and enter the hostname you control, for example dev.example.com. The dashboard then shows the DNS records to add.
  2. At your DNS provider, add a TXT record at _instawormhole followed by your domain, with the value the dashboard shows. This proves you control the domain.
  3. Add a CNAME record that points your hostname at domains.instawormhole.site.

For the example hostname, the records look like this:

TXT    _instawormhole.dev.example.com    <value shown in the dashboard>
CNAME  dev.example.com                   domains.instawormhole.site

Add the records exactly as shown. A wrong record leaves the domain pending, and a pending domain that is not verified within 7 days fails.

Step 4: Wait for Verification

InstaWormhole checks the records using public resolvers. When both match, the domain’s status changes from pending to active. To confirm, open the domain in a browser. You should see your app over HTTPS.

Step 5: Let Your Dev Server Accept the New Hostname

Even when DNS and HTTPS work, a development server can refuse requests for a hostname it does not know. InstaWormhole’s framework guide covers the settings for several tools. It shows them with a .instawormhole.site address, so if your server blocks requests to your custom hostname, apply the same setting with that hostname.

  • Vite 6 and later refuse unknown host names and answer: Blocked request. This host is not allowed. Add the host to server.allowedHosts and send hot reload through the tunnel:
export default {
  server: {
    allowedHosts: ['dev.example.com'],
    hmr: { protocol: 'wss', clientPort: 443 },
  },
}
  • Next.js 15 and later block development assets requested from other origins, which breaks hot reload and hydration. Set allowedDevOrigins in next.config.js.
  • Laravel and PHP: run the server on port 8000 with npx @instawormhole/connector 8000, then set APP_URL in your .env file so generated links use your public address. Behind a proxy, also trust it. In Laravel 11 and later, add ->withMiddleware(fn ($m) => $m->trustProxies(at: '*')) in bootstrap/app.php.

The guide also covers Expo and Shopify CLI. If you use OAuth, update your development client’s redirect URL and your local callback setting to use the new hostname.

Step 6: Test From Outside Your Network

Open the custom domain from a device that is not on your computer’s network, such as a phone with Wi-Fi turned off. If you chose a password, the browser asks for one. Enter anything as the user name and the tunnel’s password.

Then choose Open request inspector on the tunnel. Each request appears as a row with the method, the path, the status your app returned and how long it took. If the page does not load, run Tunnel Doctor from the tunnel in the dashboard. It checks each layer and names the one that failed.

Keep the Domain Healthy

Active domains are re-checked every 6 hours. If the TXT record or the address stops matching on four checks in a row, which takes about a day, the domain is detached and InstaWormhole stops serving it. Fix the records and verify the domain again in the dashboard.

Plan changes can also detach domains. If a downgrade leaves you with fewer custom domains than you have connected, the newest domains are detached first.

To undo the setup, remove the domain from the tunnel, then delete the DNS records at your DNS provider.

Protect a Tunnel on Your Own Domain

A tunnel’s public address answers anyone on the internet unless you protect it, and that applies to a custom domain too. Starter and higher plans include several layers of protection:

  • Password protection: Visitors must enter a password before reaching your app.
  • Access tokens: Suited to scripts and clients that cannot use a browser prompt.
  • IP allow and deny lists: Limit a tunnel by IP address.
  • Webhook signature checks: Add a provider’s signing secret (Stripe, GitHub, Slack or Shopify) and the inspector shows whether each captured webhook’s signature is valid. This check does not stop an invalid request from reaching your app, so your app should verify signatures itself.

When you finish testing, press Ctrl+C in the connector window. The connector stops and the public address stops answering. If your computer sleeps or the connection drops, the connector reconnects on its own and a durable tunnel keeps its address.