Skip to content

Configure TrueProxies with Puppeteer

import puppeteer from 'puppeteer';
const browser = await puppeteer.launch({
args: ['--proxy-server=http://YOUR_HOST:YOUR_HTTP_PORT'],
});
const page = await browser.newPage();
await page.authenticate({
username: 'your_username',
password: 'your_password',
});
await page.goto('https://httpbin.org/ip');
const content = await page.content();
console.log(content);
await browser.close();
await page.authenticate({
username: 'your_username-country-us',
password: 'your_password',
});
await page.authenticate({
username: 'your_username-session-abc123',
password: 'your_password',
});
const browser = await puppeteer.launch({
args: ['--proxy-server=http://YOUR_HOST:YOUR_HTTP_PORT'],
});
const urls = ['https://example.com', 'https://example.org'];
for (const url of urls) {
const page = await browser.newPage();
await page.authenticate({
username: 'your_username',
password: 'your_password',
});
await page.goto(url);
console.log(`${url}: loaded`);
await page.close();
}
await browser.close();