How to Use Proxies with Puppeteer and Playwright in 2026
By Marcus Reiner · 2026-04-08 · 10 min read · Engineering
Per-request, per-context and stealth-patched proxy setups for both Puppeteer and Playwright.
Playwright — per-context proxy (recommended)
```js const browser = await chromium.launch(); const ctx = await browser.newContext({ proxy: { server: 'http://gate.decodo.com:7000', username: 'user', password: 'pass' } }); const page = await ctx.newPage(); await page.goto('https://example.com'); ``` Per-context is best — multiple proxies in one browser instance, cleanly isolated.
Playwright — rotating per request
For per-request rotation, create a new context per page load. Cheap (~50ms overhead) and gives you a fresh IP + clean cookie jar each time.
Puppeteer — launch-arg proxy
```js const browser = await puppeteer.launch({ args: ['--proxy-server=http://gate.decodo.com:7000'] }); const page = await browser.newPage(); await page.authenticate({ username: 'user', password: 'pass' }); ``` One proxy per browser instance — for rotation, launch new browsers in a worker pool.
Puppeteer rotating per request
Use puppeteer-page-proxy or proxy-chain to switch proxies on a single browser instance. Slightly hacky but avoids the browser-launch overhead.
Stealth patches matter more than the proxy
Both libraries leak `navigator.webdriver = true` by default. Use playwright-extra + puppeteer-extra-stealth or rebrowser-patches. Without these, even a perfect residential gets flagged on Cloudflare in seconds.
- puppeteer-extra + puppeteer-extra-plugin-stealth
- playwright-extra + playwright-extra-plugin-stealth
- rebrowser-patches (drop-in, most up-to-date)
FAQ
Does Decodo work with Playwright?
Yes, and so do Oxylabs, IPRoyal, SOAX and Bright Data — all use standard HTTP CONNECT proxy auth that Playwright supports natively.