How to set up a proxy in Playwright (Browser & Per-Context Auth)
Updated:
Playwright supports native HTTP proxy authentication (server, username, password) out of the box across Chromium, Firefox, and WebKit—no browser extensions or third-party wrappers required. Even better, Playwright's Per-Context Proxy feature lets a single browser instance run dozens of isolated BrowserContext sessions, each bound to its own VinaProxy static IP.
proxy={ server: 'http://ip:port', username: 'user', password: 'pass' }- 1 IP₫40,000
- 5+ IPs₫35,000
- 10+ IPs₫25,000
- 20+ IPs₫25,000
- 50+ IPs₫25,000
- 100+ IPs₫25,000
- 200+ IPs₫25,000
- 500+ IPs₫25,000
- 1000+ IPs₫22,000
- 2000+ IPs₫20,000
- 1 IP₫50,000
- 3+ IPs₫40,000
- 5+ IPs₫40,000
- 10+ IPs₫32,000
- 50+ IPs₫30,000
- 100+ IPs₫30,000
- 200+ IPs₫30,000
- 500+ IPs₫25,000
Playwright proxy object configuration
Pass the proxy configuration object either globally in chromium.launch({ proxy }) or per session in browser.newContext({ proxy }):
| Playwright Key | Value Format | Technical Note |
|---|---|---|
server | 'http://ip:port' | Host and port only, prefixed with http:// |
username | 'user' | Your VinaProxy proxy username |
password | 'pass' | Your VinaProxy proxy password (handled natively on HTTP 407) |
bypass | 'localhost,127.0.0.1' | Optional comma-separated hosts that bypass the proxy |
Running multi-IP BrowserContexts efficiently
- On Windows and macOS, pass a placeholder
proxy: { server: 'http://per-context' }insidechromium.launch()whenever you intend to overrideproxyinside individualbrowser.newContext()calls - Set
timezoneIdandlocaleinbrowser.newContext()alongside your proxy so headers and JSIntlAPIs match the proxy country - Abort unnecessary image and font requests with
page.route()to speed up scraping throughput
Step by step
- 1
Extract ip, port, username, and password
Copy your
ip:port:user:passcredentials from the VinaProxy dashboard. - 2
Pass the proxy object to newContext()
Call
const context = await browser.newContext({ proxy: { server: 'http://ip:port', username: 'user', password: 'pass' } }). - 3
Align timezoneId and locale
Include
timezoneIdandlocalematching your proxy location (e.g.,America/New_YorkorAsia/Ho_Chi_Minh). - 4
Verify exit IP on a new page
Open
const page = await context.newPage()and requesthttps://vinaproxy.com/api/my-ip.
Frequently asked questions
Why did Playwright throw 'Proxy is only supported when browser is launched with a proxy'?
On Windows and macOS, Chromium requires a global launch proxy flag before allowing per-context overrides. Launch the browser with chromium.launch({ proxy: { server: 'http://per-context' } }) and then pass the real proxy to each browser.newContext({ proxy }).
Do VinaProxy proxies work with Playwright Firefox and WebKit too?
Yes. The exact same proxy: { server, username, password } syntax works across Chromium, Firefox, and WebKit in both Node.js and Python.
Is bandwidth metered when running headless Playwright browsers?
No. All VinaProxy Dedicated IPv4 and Static ISP plans include unlimited monthly traffic.
Scale Playwright BrowserContexts with dedicated static IPs
Instant unmetered HTTP(S) proxies across 7 global locations.
Buy Playwright Proxies