Limit Tunnel Access by IP Address for Safer Staging

2026-11-29来源 dev.toEnglish

Exposing a local development server or internal staging environment to the public internet carries an immediate risk: anyone who has the tunnel address can send traffic to your app. An address that is hard to guess is not real access control. URLs get pasted into chat, saved in browser history and copied into tickets.

For teams testing internal previews, mobile builds, or services that always call from known addresses, an IP list offers a clean solution. By restricting a tunnel to specific IP addresses or CIDR ranges, you ensure that only traffic from trusted office networks, VPN gateways or known callers reaches your local application, without forcing automated systems through a password prompt.

This guide covers how IP rules work at the edge, how they combine with InstaWormhole’s access modes, and how to configure an IP allow list or deny list without locking yourself or your team out.

Why Teams Limit Staging Tunnels by Network

Different visitors to a staging URL can handle different kinds of protection:

  • Browser visitors, such as a client reviewing a demo, can type a password or an emailed six-digit code.
  • Scripts, test runs, AI clients and webhook providers cannot answer a password prompt, and they cannot read an email, so email codes are not an option for them.
  • Services that always call from known addresses are a natural fit for an IP allow list.

An IP list checks the network a request comes from at the edge, before the request is forwarded to your computer. Listed networks connect without a prompt, and other networks are refused.

How InstaWormhole Checks a Request

From Edge to Localhost

A visitor opens your tunnel’s address over HTTPS, for example https://example.instawormhole.site. The request travels through three parts:

  1. The edge: InstaWormhole’s edge applies the tunnel’s rules in a fixed order: whether the address was disabled for violating the Acceptable Use Policy, the tunnel’s request and transfer limits, its IP list, and its password or token. A request that fails a rule is answered by the edge and never reaches your computer.
  2. The relay: A request that passes goes to the relay, which sends it to your connector over the connection the connector opened. The relay treats forwarded requests as untrusted input.
  3. The connector: The connector hands the request to your app on your own computer, only at the loopback address you gave it, such as 127.0.0.1.

Because the connector connects out to InstaWormhole, you do not open a port on your router or change your firewall for incoming traffic. Requests blocked by an IP list never reach your app.

One Access Mode, Plus an IP List

A tunnel has one access mode at a time. The IP list is separate and works on top of any of them.

Control What it does Plan
Anyone with the address No check. Anyone who has the address can open it. All plans
Password The browser asks for a password before the request reaches your app. Starter and higher
Access token The request must carry a secret token in a header. Suits scripts, AI clients and webhook providers that cannot type a password. Starter and higher
Email code Only people whose email addresses you list can open it, using an emailed six-digit code. Starter and higher
IP allow or deny list Only requests from the networks you list, or everyone except those networks, may reach the tunnel. Starter and higher

Turning on email codes replaces a password or access token on the tunnel. Adding an IP list does not.

This gives you two common setups:

  • IP list with open access: Leave the access mode on anyone with the address and restrict traffic with an IP list. This suits a service that always calls from known addresses and cannot answer a prompt.
  • IP list with a credential: Add a password, access token or email codes on top of the IP list. A visitor must pass both checks, so a leaked credential alone is not enough from an unlisted network.

Note: Setting, changing or removing a password or token ends the tunnel’s live connection. Your connector reconnects on its own in a moment, and the address does not answer until it does. An IP list change works differently: it applies within 30 seconds.

Plan Requirements and Limits

IP allow and deny lists need a plan that includes them and a durable tunnel.

  • Plan: IP lists are included from Starter ($4.99 a month, or $44.91 a year) and on Pro, Team and Business. They are not included on Free.
  • Tunnel type: IP lists apply to durable tunnels, which you create in the dashboard.
  • List size: A list holds up to 50 entries.
  • Formats: Use single addresses or networks in CIDR form, IPv4 or IPv6.

Here is how the plans compare:

Plan Monthly price Yearly price Tunnels online at once Transfer a month Requests a minute per tunnel Team members
Free $0 $0 3 5 GB 120 Not listed
Starter $4.99 $44.91 10 50 GB 600 Not listed
Pro $9.99 $89.91 25 200 GB 1,200 Not listed
Team $19.99 $179.91 50 500 GB 2,400 5
Business $39.99 $359.91 100 1 TB 4,800 10

Prices are in US dollars before any sales tax or VAT added at checkout. When a tunnel gets more requests a minute than its plan allows, the relay answers 429 until the minute passes. When the monthly transfer is used up, tunnels answer 429 until the first of next month (UTC).

How to Limit a Tunnel by IP Address

The setup takes about five minutes.

Step 1: Collect Every Network You Need

An allow list refuses everyone who is not on it, including you, if you open the address from a network you did not list. Before you enable one, gather every address that needs access, such as:

  1. Your own current public IP address, for IPv4 and for IPv6 if your connection uses both.
  2. Office egress addresses or a company VPN gateway.
  3. Addresses of teammates who work remotely.
  4. Addresses of any service that calls your tunnel, as published by that service.

Step 2: Open IP Access in the Dashboard

Open the tunnel in the dashboard and find IP access. You see Who may visit with its options.

Step 3: Choose Allow or Deny

Choose one of two options:

  • Only these networks is an allow list. Only the networks you list can reach the tunnel.
  • Everyone except these networks is a deny list. Everyone can reach the tunnel except the networks you list.

A box appears for the addresses. A visitor who is refused sees a fixed page that says the tunnel does not accept requests from their network.

Step 4: Enter Addresses and Save

Enter one address or network per line, then save:

203.0.113.10 198.51.100.0/24 2001:db8::/32 

The dashboard says the IP list is saved and that it applies within 30 seconds.

Step 5: Check Both Sides of the List

Open the address from a network that is on the list and confirm your app answers. Then open it from a network that is not on an allow list, such as a phone on mobile data with Wi-Fi turned off, and confirm you see the refusal page. The change is complete when a request from a listed network is answered and a request from another network is refused.

Avoiding Lockouts

Include Both IPv4 and IPv6

A device can reach the internet over IPv4 or IPv6. If a teammate connects over IPv6 and only their IPv4 address is on an allow list, their address will not match the list. Check which addresses a device uses and list both where needed. IPv4 and IPv6 entries share the same 50-entry limit.

Use CIDR Ranges Where Addresses Change

If a teammate’s public address changes from time to time, a CIDR range such as 198.51.100.0/24 covers a whole block of addresses with one entry. Keep ranges as narrow as you can: a wider range lets in more networks than you intend.

Route Distributed Teams Through One Address

A list holds up to 50 entries, so a large or traveling team can run out of room. If your team connects through a company VPN or proxy with a fixed public address, list that one address instead of each person.

Mind Your Phone’s Network

A phone on the same Wi-Fi as your computer shares your router’s public address, so it matches the same list entry. A phone on mobile data uses a different address and sees the refusal page unless you list it. Keep test phones on a listed network, or add the mobile address for the test.

Use Email Codes for Reviewers With Changing Addresses

For an external reviewer whose address you cannot predict, you have two options:

  1. Set Who may visit back to Everyone and turn on email codes, listing only the people who may come in. Email codes accept full addresses or whole domains, up to 100 entries. A domain entry lets in everyone at that domain, so list full addresses when you can.
  2. Keep the IP list on your main tunnel, and create a second durable tunnel protected by a password or email codes for outside reviewers. Starter allows 10 tunnels online at once.

Troubleshooting

  • A listed user sees the refusal page. Check whether their device is connecting over IPv6 when only an IPv4 address is listed, and confirm the change was saved at least 30 seconds ago.
  • Tunnel Doctor says unverified. Tunnel Doctor sends one request with no credentials from the InstaWormhole edge. On a tunnel protected by a password or email codes, the request stops at the prompt, so the result is unverified. This is expected. The docs describe this for passwords and email codes, so check any further result against your own tunnel.
  • The tunnel answers 429. For passwords, the edge allows 10 failed attempts a minute for each address and visitor, then answers 429 until the minute passes. A tunnel also answers 429 when it exceeds its plan’s requests a minute, such as 600 on Starter.
  • You want to undo the list. Set Who may visit back to Everyone and save.

Keep Your App Protected Too

An IP list narrows who can reach your tunnel, but InstaWormhole does not make your app safe. Anything the edge lets through reaches your app, so your app still needs its own protection against bad input.

Used together with a password, token or email codes where they fit, an IP list keeps unwanted networks off your local machine while the people and services you trust connect without extra steps.

Originally published at https://instawormhole.com/blog/limit-tunnel-access-by-ip-address-for-safer-staging

原文:https://www.a8q9.cn/en/article/limit-tunnel-access-by-ip-address-for-safer-staging-08741b.html

相关文章