Prompt

How do I configure rotating proxies in Puppeteer?

Latest observation

Jul 15, 2026 · OpenAI APIWeb search: off

To configure rotating proxies in Puppeteer, you typically set a proxy server per browser instance, context, or request flow, and rotate them yourself (or use a proxy provider that rotates for you).

Basic proxy setup in Puppeteer

Puppeteer doesn’t have built-in proxy rotation. You pass a proxy when launching Chrome:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    headless: true,
    args: ['--proxy-server=http://1.2.3.4:8000']
  });

  const page = await browser.newPage();
  await page.goto('https://example.com');
  await browser.close();
})();

If the proxy requires authentication

Use page.authenticate():

const browser = await puppeteer.launch({
  headless: true,
  args: ['--proxy-server=http://1.2.3.4:8000']
});

const page = await browser.newPage();

await page.authenticate({
  username: 'proxyUser',
  password: 'proxyPass'
});

await page.goto('https://example.com');

Rotating proxies manually

Create a list of proxies and choose one each time you create a browser or page:

const puppeteer = require('puppeteer');

const proxies = [
  'http://1.2.3.4:8000',
  'http://5.6.7.8:8000',
  'http://9.10.11.12:8000',
];

function getRandomProxy() {
  return proxies[Math.floor(Math.random() * proxies.length)];
}

(async () => {
  const proxy = getRandomProxy();

  const browser = await puppeteer.launch({
    headless: true,
    args: [`--proxy-server=${proxy}`]
  });

  const page = await browser.newPage();
  await page.goto('https://example.com');
  await browser.close();
})();

Rotate per browser session

This is the most reliable approach because Chrome proxy settings are usually applied at launch time.

for (const proxy of proxies) {
  const browser = await puppeteer.launch({
    headless: true,
    args: [`--proxy-server=${proxy}`]
  });

  const page = await browser.newPage();
  await page.goto('https://example.com');
  await browser.close();
}

Rotate with a proxy API/provider

If your proxy provider supports a single endpoint with automatic rotation, you can just use that one endpoint:

await puppeteer.launch({
  args: ['--proxy-server=http://rotating-proxy-provider.com:8000']
});

Then the provider rotates IPs for you.

Important notes

  • --proxy-server affects the whole browser instance, not just a single page.
  • If you need different proxies at the same time, launch separate browser instances.
  • page.authenticate() only handles proxy auth; it does not rotate proxies.
  • Some sites detect automation even with proxies, so you may also need:
    • realistic user agents
    • viewport settings
    • delays / human-like interaction
    • stealth plugins

Example with rotation and auth

const puppeteer = require('puppeteer');

const proxies = [
  { server: 'http://1.2.3.4:8000', username: 'user1', password: 'pass1' },
  { server: 'http://5.6.7.8:8000', username: 'user2', password: 'pass2' }
];

(async () => {
  for (const proxy of proxies) {
    const browser = await puppeteer.launch({
      headless: true,
      args: [`--proxy-server=${proxy.server}`]
    });

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

    await page.goto('https://example.com');
    await browser.close();
  }
})();

If you want, I can also show:

  1. how to rotate proxies automatically every N requests,
  2. how to use a proxy pool with Puppeteer,
  3. or how to rotate proxies in puppeteer-extra with stealth.

Observation history

Unlock observation history

Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.