Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions browse/src/browser-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,26 @@ export class BrowserManager {
console.log(`[browse] Extensions loaded from: ${extensionsDir}`);
}

// Honor system proxy env vars for users behind a corporate or VPN proxy.
// Playwright's chromium.launch() does not auto-read these — must be passed
// explicitly via the `proxy` launch option.
// BROWSE_PROXY — explicit override (e.g. socks5://host:port for remote DNS)
// HTTPS_PROXY — standard system HTTPS proxy
// HTTP_PROXY — standard system HTTP proxy
// BROWSE_PROXY exists for fakeip/TUN environments where the system HTTP
// proxy resolves DNS locally to fake addresses; using socks5:// forces
// remote DNS resolution at the proxy, bypassing the fake IP.
const proxyServer = process.env.BROWSE_PROXY || process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
const proxyBypass = process.env.NO_PROXY;

this.browser = await chromium.launch({
headless: useHeadless,
// On Windows, Chromium's sandbox fails when the server is spawned through
// the Bun→Node process chain (GitHub #276). Disable it — local daemon
// browsing user-specified URLs has marginal sandbox benefit.
chromiumSandbox: process.platform !== 'win32',
...(launchArgs.length > 0 ? { args: launchArgs } : {}),
...(proxyServer ? { proxy: { server: proxyServer, ...(proxyBypass ? { bypass: proxyBypass } : {}) } } : {}),
});

// Chromium crash → exit with clear message
Expand Down