Puppeteer proxy setup
Puppeteer sets the proxy address with a Chrome flag or per browser context, and the login with `page.authenticate()`.
- Protocols
- HTTP proxy on port 7000 (HTTPS sites through CONNECT). Chrome has no SOCKS5 login
- Authentication
page.authenticate()before the firstgoto; one login per browser context- Rotation
- A sticky
-sid-login: one IP per browser or per context, for up to 60 minutes - Works with
- Residential and mobile proxies
Before you start
- Node.js 22.12 or newer and
npm i puppeteer, which downloads its own Chrome for Testing. - Your proxy login and password from the Residential or Mobile page of the dashboard.
- Traffic on the product you use: a login without traffic gets 402.
- Host
gate.aeonproxy.com- Port (HTTP / HTTPS)
7000- Login
- your proxy login, with targeting keys if you need them:
LOGIN-cc-us-sid-abc123 - Password
- your proxy password
Copy the login and password from the Residential or Mobile page of the dashboard; the generator there also writes ready lines. Key syntax: targeting and sessions.
One proxy for the browser
Give Chrome the address with --proxy-server, then the login with page.authenticate() before the first goto. Chrome ignores a login written into the flag.
import puppeteer from "puppeteer";
const browser = await puppeteer.launch({
args: ["--proxy-server=http://gate.aeonproxy.com:7000"],
});
const page = await browser.newPage();
await page.authenticate({ username: "LOGIN-cc-us-sid-ab12cd34-ttl-30", password: "PASSWORD" });
await page.goto("https://api.ipify.org");
console.log(await page.$eval("body", (el) => el.innerText));
await browser.close();Chrome keeps the first proxy login that worked and sends it for every later page of the same browser context, popups included. In our test a second page with its own authenticate() and another key still went out with the first key, so use one key per context and a new context for a new key. authenticate() turns on request interception behind the scenes, which Puppeteer's docs say may cost some speed.
A proxy per browser context
createBrowserContext({ proxyServer }) gives each context its own proxy and cookies, so each can have its own country and sticky IP.
import { randomBytes } from "node:crypto";
import puppeteer from "puppeteer";
const browser = await puppeteer.launch();
for (const country of ["us", "de", "jp"]) {
const context = await browser.createBrowserContext({ proxyServer: "http://gate.aeonproxy.com:7000" });
const page = await context.newPage();
const sid = randomBytes(4).toString("hex");
await page.authenticate({ username: `LOGIN-cc-${country}-sid-${sid}-ttl-30`, password: "PASSWORD" });
await page.goto("https://api.ipify.org");
console.log(country, await page.$eval("body", (el) => el.innerText));
await context.close();
}
await browser.close();SOCKS5
Chrome supports no login for SOCKS5 proxies, and page.authenticate() does not change that: with --proxy-server=socks5://gate.aeonproxy.com:7001 pages fail with net::ERR_SOCKS_CONNECTION_FAILED. Use the HTTP port 7000.
Rotating or sticky
One page opens many connections, and a rotating login gives each of them a new IP. Use a sticky login as in the examples, and a new context with a new key when you need a new IP. To check the exit, open IP checker in the page.
Chrome also sends a few requests of its own (Google update and sign-in services) through the proxy, and they count as traffic like any other.
If it does not work
| What you see | What to check |
|---|---|
goto returns status 407 and Chrome shows "HTTP ERROR 407" | The login, the password, or a key in the login that is not in the lists. |
net::ERR_INVALID_AUTH_CREDENTIALS | The first page of the context had no authenticate() call before goto. |
net::ERR_TUNNEL_CONNECTION_FAILED | The gateway refused the tunnel, and Chrome does not show the code: usually 402 (no traffic left), 403 (a target blocked by default) or 502 (the exit failed, retry). curl with the same login prints it: CONNECT tunnel failed, response 402. |
net::ERR_SOCKS_CONNECTION_FAILED | SOCKS5 with a login, which Chrome cannot do. Use port 7000. |
| A page shows the IP or country of another page | Both pages are in one browser context, which keeps the first login. Give each key its own context. |
Questions
No. Chrome does not use a login written into proxy settings; it asks for one when the proxy answers 407, and page.authenticate() is how Puppeteer answers.
Open a new browser context with a new -sid- key, or wait for the key's -ttl- to run out. The browser itself can keep running.