Table of contents
Getting a Playwright proxy working takes one line. Getting it right takes longer: which proxy applies to which context, why SOCKS5 credentials get rejected before the browser even starts, why a wrong password sometimes shows up as a 407 page and sometimes as a 30-second timeout, and how to rotate IPs without restarting the browser for every request. This guide covers all of it for Node.js and Python, and every behaviour described here was checked by running Playwright 1.65 against local authenticated HTTP and SOCKS5 test proxies in Chromium, Firefox and WebKit.
If you only need a shortlist of providers, our best proxies for Playwright roundup covers that. This post is the hands-on companion: launch options, browser contexts, authentication, bypass rules, rotation, geo-consistency, exit-IP checks and a full error reference.
How Playwright handles proxies
Playwright accepts the same proxy object in three places: browserType.launch(), browser.newContext() and browserType.launchPersistentContext(). Playwright Test also accepts it under use in playwright.config.ts. The object has four fields:
- server (required): the proxy URL, such as
http://myproxy.com:3128orsocks5://myproxy.com:1080. If you leave out the scheme, as inmyproxy.com:3128, Playwright treats it as an HTTP proxy. - username and password (optional): credentials for an HTTP proxy that requires authentication.
- bypass (optional): a comma-separated list of hosts that should skip the proxy, such as
".example.com, internal.local".
The official docs describe two scopes: a proxy can be set "globally for the entire browser, or for each browser context individually." A browser context is Playwright's isolated, incognito-like session with its own cookies, storage and cache. You can run many contexts inside one browser process, and that is what makes per-context proxies so useful for scraping. Each context can leave through a different IP without the cost of launching a separate browser.
A Playwright proxy works at the browser's network layer, so it covers everything the page loads: documents, scripts, images, and XHR and fetch calls. It also covers context.request, the API client that belongs to a context. In our tests, context.request.get() went out through the context's proxy in all three browsers. That makes it a cheap way to check the exit IP before you load a heavy page.
Launch-level proxy: one exit for the whole browser
The simplest setup passes the proxy to launch(). Every context and page created from that browser inherits it unless the context sets its own.
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({
proxy: {
server: 'http://proxy.example.com:8000',
username: 'USERNAME',
password: 'PASSWORD',
},
});
const page = await browser.newPage();
await page.goto('https://api.ipify.org?format=json');
console.log(await page.textContent('body'));
await browser.close();
})();
The Python version takes the same keys as a dictionary. The sync API looks like this:
from playwright.sync_api import sync_playwright
PROXY = {
"server": "http://proxy.example.com:8000",
"username": "USERNAME",
"password": "PASSWORD",
}
with sync_playwright() as p:
browser = p.chromium.launch(proxy=PROXY)
page = browser.new_page()
page.goto("https://api.ipify.org?format=json")
print(page.text_content("body"))
browser.close()
If you use the Playwright Test runner, put the same object under use so every test and worker picks it up:
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
proxy: {
server: 'http://proxy.example.com:8000',
username: 'USERNAME',
password: 'PASSWORD',
},
},
});
A launch-level proxy fits when the whole job should come from one place. Typical cases are a single static ISP IP, a rotating gateway that hands out a new IP on every connection, or a test suite that has to reach a staging site through a corporate proxy. The downside is that changing the proxy means closing the browser and launching a new one. That costs far more than opening a context.
Per-context proxies with browser.newContext()
A per-context proxy is the better tool for most scraping work. You launch the browser once and give each context its own proxy:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch(); // no launch proxy needed
const us = await browser.newContext({
proxy: { server: 'http://us.proxy.example.com:8000', username: 'USER', password: 'PASS' },
});
const de = await browser.newContext({
proxy: { server: 'http://de.proxy.example.com:8000', username: 'USER', password: 'PASS' },
});
const [p1, p2] = await Promise.all([us.newPage(), de.newPage()]);
await Promise.all([
p1.goto('https://api.ipify.org?format=json'),
p2.goto('https://api.ipify.org?format=json'),
]);
console.log(await p1.textContent('body'), await p2.textContent('body'));
await browser.close();
})();
In Python, pass proxy= to new_context():
browser = p.chromium.launch()
context = browser.new_context(proxy={
"server": "http://de.proxy.example.com:8000",
"username": "USER",
"password": "PASS",
})
page = context.new_page()
We tested three contexts in one browser: two with different authenticated proxies and one with no proxy. Each context left through its own exit in Chromium, Firefox and WebKit. The context without a proxy connected directly.
Do you still need a global proxy on Windows?
Older tutorials say Chromium on Windows needs a dummy launch proxy such as launch({ proxy: { server: 'per-context' } }) before per-context proxies will work. That advice is out of date. The Windows workaround was removed in a Playwright pull request titled "remove Chromium Windows proxy hacks" (#31724, merged August 2024), and that change shipped in Playwright 1.47. A later change (#42892) went further: the 'per-context' placeholder is now simply treated as "no launch proxy." The current newContext docs only say "Network proxy settings to use with this context. Defaults to none," with no global-proxy requirement. Our own runs were on Linux, so we read the Windows behaviour from the source and changelog rather than testing it on a Windows machine. If you are pinned to a release older than 1.47, keep the dummy launch proxy.
What happens when both are set
If you set a proxy at launch and also on a context, the context's proxy wins for that context. Contexts that don't set one fall back to the launch proxy. We confirmed this in all three engines.
Loopback traffic goes through the proxy too
Browsers normally skip the proxy for localhost and 127.0.0.1. Playwright changes that for Chromium by adding Chromium's <-loopback> rule, and in our tests requests to 127.0.0.1 went through the configured proxy in Chromium, Firefox and WebKit alike. If a local dev server suddenly fails behind a proxy, add localhost or 127.0.0.1 to bypass.
Launch-level vs per-context proxy compared
| Aspect | Launch-level (launch({ proxy })) | Per-context (newContext({ proxy })) |
|---|---|---|
| Scope | Every context and page in the browser | Only that context and its pages |
| Changing IP | Close and relaunch the browser | Close the context and open a new one |
| Different exits at the same time | No | Yes, one per context |
| Cost of a switch | A full browser start | A lightweight context |
Applies to context.request | Yes | Yes |
| Overrides | Acts as the default | Wins over the launch proxy |
| Best for | Test suites, one static IP, a single rotating gateway | Scraping, multi-account sessions, geo-testing, rotation |
For most scraping jobs the rule is simple: launch one browser per worker, then use one context per identity. In this setup an identity means a proxy session plus the cookies, locale and timezone that belong with it.

Proxy authentication: credential fields, not the URL
Playwright expects proxy credentials in the username and password fields. Many proxy dashboards hand you a single connection string like http://user:pass@host:port, so it is tempting to paste that into server. Don't. Playwright normalises the server value down to scheme, host and port, so the embedded credentials are dropped. In our tests, a server value with credentials in the URL produced a 407 Proxy Authentication Required page in Chromium and WebKit and NS_ERROR_PROXY_CONNECTION_REFUSED in Firefox. The proxy never saw the credentials.
// Wrong: credentials in the URL are stripped
proxy: { server: 'http://user:pass@proxy.example.com:8000' }
// Right: split them out
proxy: {
server: 'http://proxy.example.com:8000',
username: 'user',
password: 'pass',
}
One benefit of the separate fields: you don't need to URL-encode anything. A password containing @ and : worked as-is in all three browsers when passed in password. That same password would need percent-encoding in a curl-style URL.
httpCredentials is not proxy authentication
Some older snippets set only the proxy server at launch and pass the login through newContext({ httpCredentials }). httpCredentials is for websites that use HTTP authentication, not for proxies. With Playwright 1.65 that pattern failed in every browser we tried: Chromium and WebKit showed the 407 page for HTTP URLs and failed on HTTPS, and Firefox returned NS_ERROR_PROXY_CONNECTION_REFUSED. Playwright 1.65 also tightened this boundary from the other side. Its release notes say proxy credentials "are no longer sent to websites" and now "answer only proxy challenges." Keep proxy credentials in the proxy object and website credentials in httpCredentials.
IP whitelisting as an alternative
Most commercial providers also let you authorise your server's IP address in their dashboard. In that case you only pass server and leave the credential fields out. This is also the cleanest way around the SOCKS5 limitation in the next section. For the differences between the methods, see proxy authentication explained.
SOCKS5 proxies and the authentication limitation
Playwright supports SOCKS5 proxies without authentication in all three browsers:
const browser = await chromium.launch({
proxy: { server: 'socks5://127.0.0.1:1080' },
});
It does not support SOCKS5 with a username and password, in any browser. If you add credentials, Playwright refuses to start the browser or create the context. In our runs on Chromium, Firefox and WebKit, both launch() and newContext() threw:
Browser does not support socks5 proxy authentication
The check lives in Playwright's own proxy normalisation code, which also rejects credentials on socks4://. That is why the error appears before any traffic is sent. You might try to sneak the credentials in through the URL (socks5://user:pass@host:port). Playwright strips them, the browser connects without authentication, and the proxy rejects it. In our tests this surfaced as net::ERR_SOCKS_CONNECTION_FAILED in Chromium, NS_ERROR_CONNECTION_REFUSED in Firefox and "The SOCKSv5 proxy requires authentication." in WebKit.
You have three practical workarounds:
- Use the provider's HTTP endpoint. Almost every provider that sells SOCKS5 also offers HTTP/HTTPS on the same account, and Playwright authenticates to HTTP proxies without trouble. For browser automation the protocol rarely matters. Our SOCKS5 vs HTTP proxies guide explains when it does.
- Whitelist your IP so the SOCKS5 endpoint needs no credentials.
- Run a local forwarder that accepts unauthenticated connections from the browser and adds the credentials upstream.
For the third option in Node.js, the proxy-chain package does the job. We tested version 3.0.3: anonymizeProxy() opened a local HTTP proxy that forwarded to an authenticated SOCKS5 upstream, and Chromium loaded both HTTP and HTTPS pages through it.
const { chromium } = require('playwright');
const proxyChain = require('proxy-chain');
(async () => {
// socks5h:// makes the upstream resolve hostnames, not your machine
const localUrl = await proxyChain.anonymizeProxy(
'socks5h://USER:PASS@socks.example.com:1080'
);
const browser = await chromium.launch();
const context = await browser.newContext({ proxy: { server: localUrl } });
const page = await context.newPage();
await page.goto('https://api.ipify.org?format=json');
console.log(await page.textContent('body'));
await browser.close();
await proxyChain.closeAnonymizedProxy(localUrl, true);
})();
Use socks5h:// in the upstream URL. With plain socks5://, our test showed proxy-chain resolving hostnames locally for plain-HTTP requests before handing them to the SOCKS server. That leaks DNS lookups from your machine. With socks5h://, the hostname went to the proxy for both HTTP and HTTPS.
Don't confuse SOCKS5 failures with bad credentials
If you see "Browser does not support socks5 proxy authentication", your credentials may be perfectly fine. Playwright rejected the configuration before connecting. Switch to the HTTP endpoint, whitelist your IP, or put a local forwarder in front.
Bypassing the proxy for specific hosts
The bypass field takes a comma-separated list of hosts that should connect directly. The docs give the example ".com, chromium.org, .domain.com". A leading dot matches the domain and its subdomains. Playwright converts that to a wildcard for Chromium.
const context = await browser.newContext({
proxy: {
server: 'http://proxy.example.com:8000',
username: 'USER',
password: 'PASS',
bypass: 'localhost, 127.0.0.1, .internal.example.com, cdn.example.net',
},
});
In our tests, a bypassed host connected directly while every other host in the same context still went through the proxy. Another context in the same browser without the bypass rule kept proxying that host. Bypass is useful in three situations:
- Saving residential bandwidth on heavy static assets from a CDN that doesn't block anyone. Make sure the direct requests don't reveal your server IP to a site that cares.
- Reaching local or internal services, such as a local mock API, while the target site goes through the proxy.
- Keeping telemetry or license calls off a metered proxy.
Be careful with bypass on anti-bot-protected targets. If the HTML comes from a residential IP in Germany and the images come from your data-centre IP in Virginia, that mismatch is easy to spot.
Rotation strategies in Playwright
Playwright has no built-in rotation. Rotation is something you build out of contexts. For a clear picture of what rotating gateways do on the provider side, read how rotating proxies work and what a backconnect proxy is. On the Playwright side there are four patterns.
1. A new context per proxy from a list
If you have a list of static proxies (data-centre or ISP), cycle through them and open a fresh context for each job. Closing the context throws away its cookies and cache too, so the next IP doesn't inherit the last one's session.
import asyncio, itertools
from playwright.async_api import async_playwright
PROXIES = [
{"server": "http://203.0.113.10:8000", "username": "user", "password": "pass"},
{"server": "http://203.0.113.11:8000", "username": "user", "password": "pass"},
]
URLS = ["https://example.com/page/1", "https://example.com/page/2",
"https://example.com/page/3", "https://example.com/page/4"]
IP_URL = "https://api.ipify.org?format=json"
async def fetch(browser, url, proxy):
context = await browser.new_context(proxy=proxy)
try:
exit_ip = (await (await context.request.get(IP_URL)).json())["ip"]
page = await context.new_page()
await page.goto(url, timeout=30_000)
return exit_ip, await page.title()
finally:
await context.close()
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
pool = itertools.cycle(PROXIES)
results = await asyncio.gather(*(fetch(browser, u, next(pool)) for u in URLS))
for r in results:
print(r)
await browser.close()
asyncio.run(main())
We ran this pattern against two test proxies. Four concurrent contexts in one Chromium process alternated exits exactly as the cycle dictated.
2. Gateway session IDs (sticky sessions)
Residential and mobile providers usually give you a single gateway hostname and encode targeting and session options in the username. The common pattern is to add a session token such as -session-abc123 or -sessid-abc123 to the username. Every connection that uses the same token keeps the same exit IP for a period the provider defines. A new token gets you a new IP. The exact syntax, the parameter names and the maximum session length vary by provider, so copy them from your dashboard or docs.
In Playwright this maps neatly onto contexts. Generate a session ID, put it in the context's username, do everything that needs one IP (login, pagination, checkout flow) inside that context, then close it.
const { chromium } = require('playwright');
const GATEWAY = 'http://gate.example.com:7000';
const USER = 'customer-USERNAME';
const PASS = 'PASSWORD';
const newSessionId = () => Math.random().toString(36).slice(2, 10);
async function scrapeWithFreshIp(browser, url) {
const context = await browser.newContext({
proxy: {
server: GATEWAY,
username: `${USER}-session-${newSessionId()}`, // syntax varies by provider
password: PASS,
},
});
try {
const exit = await (await context.request.get('https://api.ipify.org?format=json')).json();
console.log('exit IP:', exit.ip);
const page = await context.newPage();
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30_000 });
return await page.title();
} finally {
await context.close();
}
}
(async () => {
const browser = await chromium.launch();
for (const url of ['https://example.com', 'https://example.org']) {
console.log(await scrapeWithFreshIp(browser, url));
}
await browser.close();
})();
To test this, we pointed it at a local proxy that maps the session token in the username to an outgoing address, the way a gateway does. Two contexts that used the same session ID got the same exit, and a context with a different ID got a different one. That held in Chromium, Firefox and WebKit.
3. Per-request rotation through a gateway
If you point a context at a rotating gateway without a session token, the provider may assign a new IP per connection. A single page load opens many connections, so one page view can come from several IPs. Some sites treat that as suspicious, and logged-in sessions often break. Per-request rotation suits stateless fetching. Use sticky sessions for anything that keeps cookies.
4. Rotate on failure, not on a timer
A common production pattern keeps a session for as long as it works and rotates when you see a block signal: a 403 or 429, a CAPTCHA page, or one of the proxy errors listed below. Wrap the job in a retry loop that closes the context and opens a new one with a fresh session ID. Cap the attempts so a dead target doesn't burn your bandwidth. If CAPTCHAs are your main block signal, read our guide on how to avoid CAPTCHAs when scraping before you add more IPs.

Verify the exit IP and match its location
Check the exit IP with context.request
Never assume the proxy is applied. A typo in the server, a bypass rule that is too broad, or a context created without the proxy object will all quietly send traffic from your own IP. The cheapest check is context.request. It uses the context's proxy without rendering a page:
async function exitIp(context) {
const res = await context.request.get('https://api.ipify.org?format=json', { timeout: 15_000 });
if (!res.ok()) throw new Error(`IP check failed: ${res.status()}`);
return (await res.json()).ip;
}
const ip = await exitIp(context);
if (ip === MY_SERVER_IP) throw new Error('Proxy not applied!');
Any plain IP-echo endpoint works: api.ipify.org, httpbin.org/ip, or your provider's own checker. Compare the result against your server's real IP and, for geo-targeted jobs, against the expected country. To check the exit through the full browser stack (DNS, TLS, WebRTC), open the page with page.goto() instead. Our guide on how to test a proxy covers deeper checks for speed, anonymity and leaks.
Match timezone, locale and geolocation to the exit IP
A proxy changes your IP, not your browser. By default a Playwright context reports the host machine's timezone and locale. A German residential IP paired with America/New_York and en-US is an obvious inconsistency. Every context accepts locale, timezoneId and geolocation, so set them next to the proxy:
const context = await browser.newContext({
proxy: { server: 'http://gate.example.com:7000', username: 'USER-country-de', password: 'PASS' },
locale: 'de-DE',
timezoneId: 'Europe/Berlin',
geolocation: { latitude: 52.52, longitude: 13.405 },
permissions: ['geolocation'],
});
The Python keywords are locale, timezone_id, geolocation and permissions. We checked the result inside the page in all three engines. Intl.DateTimeFormat().resolvedOptions().timeZone returned Europe/Berlin, navigator.language returned de-DE, the request reached the server with Accept-Language: de-DE, and navigator.geolocation returned the configured coordinates.
Two details tripped us up in testing. First, geolocation needs the geolocation permission. Second, it only works on secure origins. On a plain http:// page, Chromium refused with "Only secure origins are allowed."
If your provider assigns the country dynamically, look up the exit IP first, either with your provider's IP-info endpoint or a geolocation API you trust. Then create the real context with matching settings. A context's settings are fixed when it is created, which is one more reason the context is the right unit of identity.
Common Playwright proxy errors and what they mean
Each browser engine reports proxy failures in its own words. Chromium has the most familiar names. Firefox lumps several failures under one code, and WebKit uses plain-English messages. Below is what we actually got from Playwright 1.65 when we broke things on purpose:
| Cause | Chromium | Firefox | WebKit |
|---|---|---|---|
| Nothing listening on the proxy host:port | net::ERR_PROXY_CONNECTION_FAILED | NS_ERROR_PROXY_CONNECTION_REFUSED | "Could not connect to proxy server … Connection refused" |
| Missing or wrong proxy credentials, HTTP URL | A 407 response page | NS_ERROR_PROXY_CONNECTION_REFUSED | A 407 response page |
| Missing or wrong proxy credentials, HTTPS URL | Hangs until the navigation timeout | NS_ERROR_PROXY_CONNECTION_REFUSED | Fails with an unrelated-looking message ("Download is starting") |
| Proxy can't reach the target over HTTPS (CONNECT refused, e.g. 502/503) | net::ERR_TUNNEL_CONNECTION_FAILED | NS_ERROR_CONNECTION_REFUSED | Fails with a generic message |
| SOCKS5 proxy can't reach the target | net::ERR_SOCKS_CONNECTION_FAILED | NS_ERROR_CONNECTION_REFUSED | "Connection refused through SOCKSv5 proxy." |
| Proxy accepts the connection but never answers | Timeout … exceeded | Timeout … exceeded | Timeout … exceeded |
| Credentials set on a SOCKS5 proxy | Throws "Browser does not support socks5 proxy authentication" from launch() or newContext() | ||
ERR_PROXY_CONNECTION_FAILED
The browser couldn't open a TCP connection to the proxy itself. Check the hostname and port, firewall rules on your server, and whether you used the right port for the protocol (HTTP and SOCKS ports often differ). In Firefox the same failure shows up as NS_ERROR_PROXY_CONNECTION_REFUSED.
ERR_TUNNEL_CONNECTION_FAILED
The browser reached the proxy, but the proxy refused to open the HTTPS tunnel. For HTTPS pages the browser sends an HTTP CONNECT, and any non-200 reply ends here. Typical causes are an upstream failure (the proxy returns 502 or 503), a blocked destination port, a target the provider forbids, or an exhausted plan. For plain HTTP URLs the same upstream failure shows up as a normal page with the proxy's 5xx status instead. Our proxy error codes guide breaks down the individual status codes.
407 Proxy Authentication Required
On plain HTTP URLs, Chromium and WebKit render the proxy's 407 page, so page.goto() resolves with response.status() === 407 instead of throwing. Always check the status. On HTTPS URLs the 407 arrives in response to CONNECT. In our tests Chromium never surfaced a clear error there and simply waited until the navigation timed out. That makes a wrong password look like a slow proxy. When you see unexplained HTTPS timeouts, run a quick HTTP request through the same proxy, or a curl check, to rule out credentials. The usual culprits are credentials pasted into the server URL, credentials passed through httpCredentials, a whitelisted IP that has changed, or a username typo in the session parameters.
ERR_SOCKS_CONNECTION_FAILED
The SOCKS handshake or the SOCKS-level connect failed. That covers an unreachable target, a rejected request, or a SOCKS server that demands authentication Playwright can't provide. If you configured a SOCKS5 proxy that needs a password, this is the error you get once the credentials are stripped.
Timeouts
Playwright's default navigation timeout is 30 seconds. A proxy that accepts connections but stalls, an overloaded residential exit, or the silent HTTPS 407 case above will all end with page.goto: Timeout 30000ms exceeded. Set an explicit timeout on goto() that suits your proxy type. Residential exits are slower than data-centre ones. Treat a timeout as a signal to rotate instead of retrying the same session forever.
A quick triage order
When a Playwright proxy fails, test the same proxy with curl first. If curl fails too, the problem is the proxy, the credentials or the network. If curl works and Playwright doesn't, check that credentials are in username/password, that you aren't using SOCKS5 with a password, and that no bypass rule matches your target.
Chromium, Firefox and WebKit differences
The proxy option is the same in every engine. Per-context proxies, launch proxies, overrides, bypass rules, HTTP authentication and unauthenticated SOCKS5 all worked across Chromium, Firefox and WebKit in our tests. The differences show up in the details:
| Behaviour (Playwright 1.65, tested) | Chromium | Firefox | WebKit |
|---|---|---|---|
| Launch-level HTTP proxy with auth | Yes | Yes | Yes |
| Per-context proxy without a launch proxy | Yes | Yes | Yes |
| SOCKS5 without auth | Yes | Yes | Yes |
| SOCKS5 with username/password | No (Playwright throws) | No (Playwright throws) | No (Playwright throws) |
| Loopback requests proxied by default | Yes | Yes | Yes |
| Error style | net::ERR_* codes | NS_ERROR_* codes | Plain-text messages |
| Wrong proxy password on HTTP URL | 407 page | Throws | 407 page |
Two practical consequences follow. First, if you match errors with message.includes('ERR_PROXY_CONNECTION_FAILED'), that only works for Chromium. For cross-browser code, classify on a set of patterns per engine, or just treat any navigation error during the exit-IP check as "rotate this proxy." Second, because Firefox reports a missing or wrong password the same way as an unreachable proxy, debug authentication in Chromium first, where the 407 is visible.
The proxy object is the same in Node.js and Python, including the async API. The only differences are naming: new_context, timezone_id and ignore_https_errors in Python versus camelCase in JavaScript. If you already use proxies in plain scripts, our Node.js proxy guide and Python Requests proxy guide cover the non-browser side. For Puppeteer, which handles authentication differently through page.authenticate(), see how to use proxies with Puppeteer.
Proxy providers that work well with Playwright
Any provider with an authenticated HTTP endpoint will work with the setup above. These three stand out for Playwright work because of their documentation and the session controls they offer.
Decodo
Decodo (formerly Smartproxy) is an approachable choice for Playwright users who want residential, ISP and data-centre pools on one dashboard. Its own engineering content walks through Playwright setups with sticky sessions set per context through the username, which maps directly onto the rotation patterns above.

Decodo
Decodo offers the best price-to-performance ratio in the industry. It delivers roughly 90% of what the enterprise leaders provide — high success rates, a large clean pool, sticky sessions, an unblocker — at a fraction of their cost. The dashboard is the friendliest of any major provider, the 14-day money-back guarantee removes the risk of trying it, and support actually responds. The main gaps are enterprise-grade compliance tooling and the very deepest targeting, neither of which most teams need. For startups, solo developers, and any team that wants professional results without enterprise pricing, Decodo is our top value pick and an easy recommendation.
Oxylabs
Oxylabs publishes a dedicated Playwright integration page and detailed session-control docs. Its residential gateway takes country targeting and a sessid sticky-session parameter in the username, plus an option to extend session length. That fits the context-per-identity model well. Use its HTTP endpoint with Playwright rather than SOCKS5, since Playwright can't send SOCKS5 credentials.

Oxylabs
Oxylabs is the enterprise provider that gets the fundamentals right. The network is huge and well-maintained, the scraper APIs are genuinely best-in-class, and the documentation and SDKs make integration faster than almost any competitor. What sets it apart from Bright Data is service: dedicated account managers, responsive support, and cleaner tooling mean less time fighting the platform and more time shipping. The cost is higher entry pricing, and the deepest discounts favor high-volume commitments. For serious commercial data operations that can justify the spend, Oxylabs is a top-two choice and frequently the one teams stay with long-term.
Zyte
Zyte takes a different approach. Zyte API handles rotation, ban detection and browser rendering on its side. Zyte's own docs note that its proxy mode is "not optimized for use in combination with browser automation tools" and point Playwright users to its browser automation features or a Zyte-managed browser over CDP instead. If you want to stop maintaining your own Playwright fleet, it is worth a look. If you want a plain proxy for your own browsers, choose one of the two above.

Zyte
Zyte API is the most complete scraping-as-a-service offering from the most credible engineering lineage in the space (they wrote Scrapy). Automatic ban handling, escalation, and rendering behind a success-priced API genuinely deletes the proxy-ops workload. It is not a general-purpose proxy — account management and browser-based workflows need conventional providers — and heavy scraping teams with anti-bot expertise can beat its per-request economics. For developer teams whose product is the data, not the infrastructure, it is the benchmark.
Production checklist
- Launch one browser per worker and give each identity its own context with its own
proxy. - Put proxy credentials in
username/password, never in the server URL and never inhttpCredentials. - Use HTTP endpoints, or whitelisted SOCKS5, because Playwright cannot authenticate to SOCKS5.
- Check the exit IP with
context.requestbefore you load the target. - Set
locale,timezoneIdand, if needed,geolocationto match the exit country. - Keep sticky sessions for stateful flows and rotate on block signals, not on every request.
- Check
response.status()aftergoto(), since a 407 can come back as a normal response. - Set explicit timeouts and cap retries. Close contexts in a
finallyblock so failed jobs don't leak memory. - If you are on Playwright older than 1.47 and run Chromium on Windows, keep a dummy launch proxy for per-context proxies, or upgrade.
With contexts as your unit of identity, a single Playwright browser can run many independent sessions, each with its own IP, cookies, language and clock. That is cheaper than one browser per IP.
Frequently asked questions
Pass a proxy object with server, and optionally username, password and bypass, to browserType.launch() for the whole browser or to browser.newContext() for a single context. In Python the same keys go in a dictionary passed as proxy=. A scheme-less server like myproxy.com:3128 is treated as an HTTP proxy.
Yes. browser.newContext({ proxy }) gives each context its own exit IP inside one browser process, and a context proxy overrides any proxy set at launch. In our tests with Playwright 1.65 this worked in Chromium, Firefox and WebKit without any launch proxy.
Not on current versions. The Chromium-on-Windows workaround was removed in Playwright 1.47, and the old 'per-context' placeholder is now treated as no launch proxy. If you are stuck on an older release, keep a dummy launch proxy.
No. Playwright supports unauthenticated SOCKS5, but adding credentials makes launch() or newContext() throw 'Browser does not support socks5 proxy authentication' in every browser. Use the provider's HTTP endpoint, whitelist your IP, or run a local forwarder that adds the credentials upstream.
The proxy didn't receive valid credentials. The usual causes are putting user:pass inside the server URL, which Playwright strips, or passing proxy credentials through httpCredentials, which only answers website challenges. Put them in the proxy object's username and password fields instead.
Close the current browser context and open a new one with the next proxy from your list or a new session ID in the gateway username. Contexts are cheap to create, so you don't need to relaunch the browser. Check the exit IP with context.request before scraping.
Call an IP-echo endpoint such as api.ipify.org through context.request.get(), which uses the context's proxy without rendering a page. Compare the result with your server's own IP and the country you expect. For a full-browser check, load the same URL with page.goto().
It means Chromium reached the proxy, but the proxy refused to open the HTTPS tunnel requested with CONNECT, for example with a 502 or 503 from the upstream. Check the target host and port, your plan and any provider restrictions. Firefox reports the same situation as NS_ERROR_CONNECTION_REFUSED.