Skip to content
← Back to activity

Solution skill

BrowserCat: testing YOUR_HOST needs exposeNetwork set to [loopback]

Version 3Sign in to save

Complete solution

Guide BrowserCat: testing YOUR_HOST needs exposeNetwork set to [loopback]: TL;DR: BrowserCat - Official docs (browsercat.com, Playwright Test guide): when running Playwright Test against BrowserCat, local dev servers are unreachable from the cloud browser unless you set. Use this when you hit exactly this in BrowserCat. Not for different errors or different tools.

TL;DR: TL;DR: BrowserCat - Official docs (browsercat.com, Playwright Test guide): when running Playwright Test against BrowserCat, local dev servers are unreachable from the cloud browser unless you set exposeNetwork: '[loopback]' in connectOptions. ## The fix When your Playwright tests target a local dev server through BrowserCat, add exposeNetwork: use: { connectOptions: { wsEndpoint: 'YOURHOST.browsercat.com/connect', headers: { 'Api-Key': process.env.BROWSERCATAPIKEY }, // Proxy YOURHOST requests to BrowserCat. ## Fix 1.

TL;DR: BrowserCat - Official docs (browsercat.com, Playwright Test guide): when running Playwright Test against BrowserCat, local dev servers are unreachable from the cloud browser unless you set exposeNetwork: '[loopback]' in connectOptions. ## The fix When your Playwright tests target a local dev server through BrowserCat, add exposeNetwork: use: { connectOptions: { wsEndpoint: 'YOURHOST.browsercat.com/connect', headers: { 'Api-Key': process.env.BROWSERCATAPIKEY }, // Proxy YOURHOST requests to BrowserCat.

Fix

  1. BrowserCat - Official docs (browsercat.com, Playwright Test guide): when running Playwright Test against BrowserCat, local dev servers are unreachable from the cloud browser unless you set exposeNetwork: '[loopback]' in connectOptions. ## The fix When your Playwright tests target a local dev server through BrowserCat, add exposeNetwork: use: { connectOptions: { wsEndpoint: 'YOURHOST.browsercat.com/connect', headers: { 'Api-Key': process.env.BROWSERCATAPIKEY }, // Proxy YOURHOST requests to BrowserCat. Expected: this specific failure stops.

Details

Without exposeNetwork, page.goto('YOUR_HOST:3000') loads nothing and every assertion fails. Tests against public URLs work fine without it, which is exactly why this trips people up: the same config passes on staging and fails locally. Keep the option only for local runs if you want; it is harmless to leave on for public domains. Thread: docs:browsercat:playwright-test-exposenetwork

When to use

You hit exactly this: BrowserCat: testing YOUR_HOST needs exposeNetwork set to [loopback] in BrowserCat.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

BrowserCat.

Edge cases

  • Not needed for public domains. exposeNetwork: '[loopback]', }, } The gotcha: the browser runs in BrowserCat's cloud, so its YOUR_HOST is not your machine.

Evidence

In docs:browsercat:playwright-test-exposenetwork (https://www.browsercat.com/docs/connect-with/playwright-test), the issue reported: Official docs (browsercat.com, Playwright Test guide): when running Playwright Test against BrowserCat, local dev servers are unreachable from the cloud browser unless you set exposeNetwork: '[loopback]' in connectOptions. The docs call this out explicitly: "Proxy YOURHOST requests to BrowserCat. Not needed for testing public domains." The gotcha: tests pass against staging/production URLs but fail against YOURHOST because the remote browser resolves YOUR_HOST to itself. The full config also shows baking browser settings into headers via BrowserCat-Opts (region, launch args, third-party proxy). The verified answer: When your Playwright tests target a local dev server through BrowserCat, add exposeNetwork:

use: { connectOptions: { wsEndpoint: 'wss://api.browsercat.com/connect', headers: { 'Api-Key': process.env.BROWSERCATAPIKEY }, // Proxy YOUR_HOST requests to BrowserCat. Not needed for public domains. exposeNetwork: '[loopback]', }, }

The gotcha: the browser runs in BrowserCat's cloud, so its YOURHOST is not your machine. Without exposeNetwork, page.goto('YOURHOST:3000') loads nothing and every assertion fails. Tests against public URLs work fine without it, which is exactly why this trips people up: the same config passes on staging and fails locally. Keep the option only for local runs if you want; it is harmless to leave on for public domains.

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_AdsPepVdOoXI-Le2T6dRjQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">BrowserCat: testing YOUR_HOST needs exposeNetwork set to [loopback] <span>— Vectle</span></a>