Tunnel Agent — Test Localhost & Internal Apps
The Tunnel Agent lets you test applications that aren’t publicly accessible — localhost development servers, internal staging environments, and apps behind corporate firewalls. It creates a tunnel between your machine and InsightJet’s cloud testing infrastructure.
Why You Need It
Section titled “Why You Need It”InsightJet runs Playwright browsers in the cloud. Without the tunnel agent, those browsers can only reach public URLs. The tunnel agent solves this by routing cloud browser traffic through your local machine:
InsightJet Cloud (Playwright) → Tunnel → Your Machine → localhost:3000This means you can:
- Test during development — analyze and discover components on
localhost - Test staging environments — reach internal servers behind firewalls
- Test private networks — access intranet tools and internal dashboards
- Test before deployment — catch UI issues before code goes public
Installation
Section titled “Installation”The tunnel agent is an npm package you install globally:
npm install -g insightjet-
Log in
Run the login command — it opens your browser to authenticate:
Terminal window insightjet loginYour browser opens to InsightJet’s login page. After authenticating, the token is saved locally to
~/.insightjet/config.json. -
Start the agent
Terminal window insightjet start --allow localhost:3000--allowis required: it names the addresses (host and port) InsightJet may reach. The agent connects to InsightJet’s crawler gateway over a WebSocket and is ready to forward requests. -
Learn your local app
In InsightJet, click Learn and enter your local address with its scheme, exactly as your app is served:
http://localhost:3000for a plain dev server,https://localhost:3000for one served over https (a self-signed certificate is fine). InsightJet keeps the address as you typed it. During setup, choose Runs on your computer (localhost)? Connect it with our tunnel on the Add your app step; it shows the same commands. A local address (localhost,*.local, a private network address) is always crawled through your tunnel, and a public one never is. If the agent is not running, InsightJet says so and starts nothing.Settings → Tunnel shows the same steps and when your tunnel last started or reconnected. The terminal running
insightjet startshows whether it is connected now.
What to Expect
Section titled “What to Expect”The first pages of a local crawl can take a minute or two to appear, because the crawler’s browser starts up first.
Commands
Section titled “Commands”| Command | Description |
|---|---|
insightjet login | Authenticate via browser and save credentials |
insightjet start --allow localhost:3000 localhost:8080 | Start the tunnel; it forwards only to the listed addresses (--allow is required) |
insightjet status | Show who is signed in and which InsightJet server the agent uses |
insightjet logout | Clear saved credentials |
Without installing, npx insightjet login and npx insightjet start --allow localhost:3000 work the same way. Run the tunnel on one computer at a time: InsightJet sends your crawls through the one that started last.
Host Allowlist
Section titled “Host Allowlist”The agent forwards nothing until you name what it may reach. --allow is required and takes one or more addresses, each with its port:
insightjet start --allow localhost:3000 localhost:8080 192.168.1.50:443Only requests to the listed host:port combinations will be forwarded. All others are rejected, and an address without a port is refused when the agent starts.
Managing Tokens
Section titled “Managing Tokens”Tunnel tokens are in Settings → Keys → Tunnel tokens:
- New tunnel token — create a token with a name (e.g., “MacBook Pro”). It is shown once and works for 90 days.
- Revoke — invalidate a token immediately
You can have multiple tokens for different machines (e.g., work laptop, home desktop).
Settings → Tunnel shows when your agent last started or reconnected. Whether it is connected now is shown in the terminal where it runs.
How It Works
Section titled “How It Works”The tunnel is a reverse proxy that ends at InsightJet’s crawler gateway:
-
Ticket — the agent asks InsightJet for a short-lived ticket with your token (a new one for every connection)
-
Agent connects — the agent opens a WebSocket to the crawler gateway and shows the ticket; the gateway refuses a connection without a valid one
-
Crawl routed — when you crawl a local address, InsightJet tells the crawler to use your tunnel; public addresses never go through it
-
Traffic flows — browser requests travel through the gateway → WebSocket → your agent → local TCP connection → your app
-
Bidirectional streaming — responses flow back through the same path. Each connection gets a unique stream ID for multiplexing
Security
Section titled “Security”| Feature | Details |
|---|---|
| Encrypted transport | The ticket request to InsightJet uses HTTPS and the connection to the crawler’s gateway uses WSS; the agent refuses an address that is not encrypted. Each ticket lives five minutes and works for your tunnel only |
| JWT authentication | Tokens are signed, expire in 90 days, and can be revoked instantly; your token is sent only to InsightJet, never to the gateway |
| Host allowlist | Required: only the exact host:port addresses you list can be reached |
| Stream isolation | Each browser connection gets a unique stream ID |
| No inbound ports | Your machine doesn’t need any open ports — the agent initiates the outbound connection — and no port is opened on insightjet.ai: the tunnel ends at the crawler’s gateway |
Troubleshooting
Section titled “Troubleshooting”| Issue | Solution |
|---|---|
| Agent won’t connect | Check your internet connection and that wss://api.insightjet.ai is not blocked by your firewall, then check the terminal running insightjet start says “Connected to InsightJet’s crawler gateway” |
| Token expired | Run insightjet login to re-authenticate (tokens expire after 90 days) |
| A crawl can’t reach localhost | Verify your local app is running, and check the terminal running insightjet start says “Connected to InsightJet’s crawler gateway” |
| A local crawl fails right away | Check that the address starts with the scheme your app really uses (http:// or https://), and that the terminal running insightjet start says it is connected |
| Connection drops | The agent reconnects by itself with exponential backoff, also after a network drop or a sleeping laptop, and asks for a fresh ticket each time. If it keeps dropping, check your network stability. Run npm install -g insightjet@latest to get the newest version |
| Port conflicts | The agent doesn’t listen on local ports — it initiates outbound connections only |