Skip to content
Headless Chrome (Node.js)

How to use proxies with Puppeteer

Launch Puppeteer with args: ["--proxy-server=http://HOST:PORT"], then call await page.authenticate({ username: "USERNAME", password: "PASSWORD" }) before page.goto. Chrome ignores credentials inside --proxy-server, so page.authenticate is required.

What you need

Puppeteer drives a real Chrome, so it inherits Chrome's proxy rules: the proxy is set at launch (or per browser context), credentials are answered when the proxy asks for them, and SOCKS5 with a username and password isn't supported.
  • An active CleanProxies plan: static ISP proxies for fixed US IPs, or rotating residential / mobile proxies for pools. The trial works too.
  • Your credential line from the dashboard's proxy manager: host (or IP), port, username and password.
  • Node.js 20+ and npm install puppeteer (it downloads a matching Chrome).

New to proxies? For the overview, read Proxies with Python Requests, Playwright and Puppeteer and Rotating vs sticky sessions. This guide goes deeper on Puppeteer only.

Your CleanProxies credentials

Every CleanProxies product works over HTTP(S) and SOCKS5. This is what the dashboard gives you.
ProductLine in your dashboardNotes
Static ISP proxiesIP:PORT:USER:PASSOne line per dedicated IP. With IP whitelisting turned on, the line is just IP:PORT and no password is sent.
Rotating residential and mobileHOST:PORT:USER:PASSGenerated in the proxy manager. The username carries the location and session you pick, so generate a new list to change them.

Most tools want the same details as a URL: http://USERNAME:PASSWORD@HOST:PORT for HTTP(S) or socks5://USERNAME:PASSWORD@HOST:PORT for SOCKS5. The examples on this page use those placeholders; copy the host, port, username and password from your CleanProxies dashboard. To convert a whole list at once, paste it into the proxy list formatter.

How to set up CleanProxies in Puppeteer

  1. 1

    Launch with the proxy

    Pass --proxy-server=http://HOST:PORT in args. Leave the credentials out of this flag.
  2. 2

    Authenticate each page

    Call page.authenticate({ username, password }) on every new page before it navigates.
  3. 3

    Navigate

    Open your target. HTTPS sites tunnel through the proxy end to end.
  4. 4

    Check the exit IP

    Go to https://api.ipify.org and read the page text.

Puppeteer proxy example

proxy.mjsJavaScript
import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  args: ["--proxy-server=http://HOST:PORT"],
});

const page = await browser.newPage();
await page.authenticate({ username: "USERNAME", password: "PASSWORD" });

await page.goto("https://api.ipify.org", { waitUntil: "domcontentloaded" });
console.log("Exit IP:", await page.evaluate(() => document.body.innerText));

await browser.close();

A different proxy per browser context

One browser can run several isolated contexts, each with its own proxy, cookies and storage. That's the efficient way to run many accounts or locations in one Chrome process.

Proxy per contextJavaScript
const lines = ["IP1:PORT:USER1:PASS1", "IP2:PORT:USER2:PASS2"];

for (const line of lines) {
  const [host, port, username, ...rest] = line.split(":");
  const context = await browser.createBrowserContext({ proxyServer: `http://${host}:${port}` });
  const page = await context.newPage();
  await page.authenticate({ username, password: rest.join(":") });
  await page.goto("https://api.ipify.org");
  console.log(await page.evaluate(() => document.body.innerText));
  await context.close();
}

SOCKS5 and leak prevention

  • Chrome supports no authentication method for SOCKS5, so page.authenticate can't answer a SOCKS5 proxy. Use the HTTP form of your CleanProxies line, or SOCKS5 on an ISP proxy authorized by IP whitelisting (--proxy-server=socks5://IP:PORT).
  • With an HTTP proxy, Chrome sends the hostname in the CONNECT request, so DNS is resolved on the proxy side.
  • Add --force-webrtc-ip-handling-policy=disable_non_proxied_udp to args so WebRTC can't reveal your server's IP.

Static ISP vs rotating residential in Puppeteer

Both products use the same setup. What changes is how long an IP stays with you.

Static ISP proxies

Map one dedicated US ISP IP to one browser context per account. The IP never rotates, so cookies, fingerprint and address stay consistent across runs.

Static ISP ProxiesAs low as $0.75/IP

Rotating residential proxies

A rotating line can change IP between connections, which breaks logins mid-flow. For Puppeteer, generate sticky lines in the CleanProxies dashboard; use rotating lines only for single-page, logged-out fetches.

Rotating Residential ProxiesAs low as $0.63/GB

Verify your exit IP

The first example prints the exit IP. For a fuller check, open What is my IP? in the proxied page and take a screenshot.

Open What is my IP? through the proxy to see the address and headers a website receives, or paste up to ten lines into the free proxy checker to test connectivity, latency and exit IP before you start.

Troubleshooting Puppeteer proxy errors

ProblemLikely causeFix
net::ERR_TUNNEL_CONNECTION_FAILEDThe proxy refused the CONNECT, usually missing or wrong credentials.Call page.authenticate before goto on every page, with the exact dashboard credentials.
net::ERR_PROXY_CONNECTION_FAILEDWrong host or port, or blocked outbound traffic.Test the line with curl -x; check the port.
Auth works on the first page onlyauthenticate is per page.Call it for each new page, including popups.
SOCKS5 with credentials failsChrome doesn't support SOCKS5 authentication.Switch to http:// or use IP whitelisting.
WebRTC leakWebRTC uses non-proxied UDP.Add --force-webrtc-ip-handling-policy=disable_non_proxied_udp.

Still stuck? Our 24/7 support team answers fast: contact us with the error and the line you used (leave the password out).

Puppeteer proxy FAQs

No. Chrome ignores credentials in that flag. Pass them with page.authenticate instead.

Get CleanProxies for Puppeteer

Super clean US ISP IPs from $0.75/IP with unlimited bandwidth, rotating residential from $0.63/GB and mobile from $0.79/GB. Instant delivery, 99.9% uptime and 24/7 support.