Skip to content
Puppeteer

Using our proxies with Puppeteer

Puppeteer passes the proxy to Chrome as a command-line switch. Credentials are not part of that switch; Puppeteer answers the authentication challenge with page.authenticate.

Pick a proxy

Compatibility

  • The proxy is set through launch option args, e.g. --proxy-server=http://host:port; Chrome supports HTTP, HTTPS, SOCKSv4 and SOCKSv5 proxy schemes.
  • Chrome does not use credentials embedded in proxy settings; page.authenticate() supplies a username and password when an authentication challenge arrives.
  • page.authenticate() enables request interception under the hood, which the Puppeteer docs note can slow pages down.
  • Chrome supports no authentication method for SOCKSv5, so a SOCKS5 proxy needs IP allowlist access.
Protocols:
HTTP, HTTPS (CONNECT), SOCKS5
Connection:
Username and password, IP allowlist

Configuration

// check-ip.mjs
import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  args: ["--proxy-server=http://PROXY_HOST:PORT"],
});
const page = await browser.newPage();
// Credentials are answered on the auth challenge; skip for IP allowlist.
await page.authenticate({ username: "USERNAME", password: "PASSWORD" });
await page.goto("https://api.ipify.org?format=json");
console.log(await page.evaluate(() => document.body.innerText));
await browser.close();

The browser starts with one HTTP proxy for all pages; page.authenticate() is called before the first navigation. For IP allowlist access, remove the authenticate call.

PROXY_HOST, PORT, USERNAME and PASSWORD are placeholders. After we select proxies for your task, we send you the real host, port and credentials.

Check the result

node check-ip.mjs
// expected output: {"ip":"<exit IP>"}
  1. Run node check-ip.mjs and confirm the printed ip equals the exit IP we sent you.
  2. Look up the exit IP in two independent GeoIP services and confirm both show the country (and city, if you asked for one) from your request. GeoIP databases can disagree; tell us if they do.
  3. Open a page of your own site through the same browser and check the localized content, redirects and resources for that country.

What to put in the request

  • Protocol: HTTP with username/password, or SOCKS5 with IP allowlist.
  • Whether you need a different exit IP per browser (the --proxy-server switch applies to the whole browser process).
  • Countries and session mode (static or sticky) for your test runs.
  • The sites under test and confirmation that you own them or may test them.

Common pitfalls

  • Writing http://USERNAME:PASSWORD@host:port into --proxy-server: Chrome ignores embedded credentials, so requests fail with an authentication error.
  • Calling page.authenticate() after page.goto(): the first navigation is then sent without credentials.
  • Expecting per-page proxies from one launch: --proxy-server is browser-wide, so start separate browsers for separate exit IPs.

Recommended proxy types

Sources

Not sure which proxy fits?

Describe the task in two sentences. We reply with a concrete setup and price, usually within one business day.

Availability, exact parameters and price are confirmed in our reply after manual selection. Nothing is charged automatically.

Pick a proxy