### Environment - Product: Cloudflare Workers with Browser Rendering (@cloudflare/puppeteer) - @cloudflare/puppeteer version: 1.0.4 - Worker runtime: (fill in) - wrangler version: (fill in) - Plan/zone: (fill in) - Region/location: (fill in) - Proxy type: HTTP proxy (host:port), with basic auth ### Summary I’m trying to run a browser session in a Worker using Browser Rendering and route its outbound traffic through an upstream HTTP proxy. The same proxy configuration works locally with standard Puppeteer. In the Worker, creating a proxied BrowserContext and authenticating the page consistently fails with: - Error: net::ERR_PROXY_CONNECTION_FAILED This suggests upstream proxying may not be supported, or there are format/egress constraints that aren’t documented. ### Expected behavior - Setting `proxyServer` on `createBrowserContext` and authenticating via `page.authenticate` should work in Workers similar to local Puppeteer. ### Actual behavior - In the Worker: navigation fails with `net::ERR_PROXY_CONNECTION_FAILED`. - Locally (Node + Puppeteer): identical proxy settings succeed. ### How the proxy is added (Worker code) - We create a per-context proxy and authenticate the page: ```ts import puppeteer, { type Browser, type Page } from '@cloudflare/puppeteer'; export default { async fetch(request: Request, env: Env): Promise { let browser: Browser | null = null; let context: any | null = null; let page: Page | null = null; try { browser = await puppeteer.launch(env.MYBROWSER, { /* optionally: location: 'US' */ }); if (env.PROXY_SERVER) { // Examples tried for PROXY_SERVER: "host:port", "http://host:port" context = await browser.createBrowserContext({ proxyServer: env.PROXY_SERVER }); page = await context.newPage(); if (env.PROXY_USER && env.PROXY_PASS) { await page.authenticate({ username: env.PROXY_USER, password: env.PROXY_PASS, }); } } else { page = await browser.newPage(); } await page.setViewport({ width: 1280, height: 720 }); await page.goto('https://example.com', { waitUntil: 'domcontentloaded', timeout: 30000 }); return new Response('OK'); } catch (err) { return new Response(String(err), { status: 500 }); } finally { try { if (page) await page.close(); } catch {} try { if (context) await context.close(); } catch {} try { if (browser) await browser.close(); } catch {} } }, } satisfies ExportedHandler; ``` ### Local comparison (works) - Using Puppeteer locally with the same proxy settings and calling: - `browser.createBrowserContext({ proxyServer })` - `page.authenticate({ username, password })` - Navigation succeeds and outbound requests go through the proxy. ### Proxy formats tried - PROXY_SERVER: `host:port` - PROXY_SERVER: `http://host:port` - Credentials set via `page.authenticate`. - Also tried adding credentials inline (`http://user:pass@host:port`) with and without `page.authenticate`. ### Logs / error - Browser response/navigation fails with: - `Error: net::ERR_PROXY_CONNECTION_FAILED` - No other Worker-side errors besides that navigation error. ### Questions 1. Is upstream proxying supported for Browser Rendering in Workers? If yes, what is the officially supported way and the exact expected `proxyServer` string format (scheme required? supported schemes?)? 2. Are there egress restrictions (ports, destination types) that would block connecting to external HTTP proxies? 3. If unsupported, can you confirm and add documentation to clarify? Is there a recommended alternative (e.g., location-based egress only) for IP/region control? ### Additional context - I’m aware `BrowserContextOptions` exposes `proxyServer?: string;` and the docs say “Username and password can be set in `Page.authenticate`.” This works locally, but fails on Workers. - The same proxy endpoint is reachable and functions correctly from non-Worker environments.