Skip to content
Web Scraping

How to Set Up a Proxy in Puppeteer

Learn how to set up a proxy in Puppeteer, handle authentication, and use rotating proxies to avoid getting blocked.

my photo Zenezen
June 24, 2026 2 min read
How to Set Up a Proxy in Puppeteer 1

Don't want to read?

Time is a precious resource, get the insights you need using your favorite AI chat.


When you're running Puppeteer for web scraping or automation, your requests go out from the same IP every time. Sites with bot detection will catch on quickly and block you before you get far. Adding a proxy routes your traffic through a different IP, keeping your sessions alive and your data flowing.

In this article, we'll explore how to set up a proxy in Puppeteer, the different ways to configure it, and how to pair it with rotating proxies for large-scale scraping.


How to Set Up a Proxy in Puppeteer

How to Set Up a Proxy in Puppeteer

Setting up a proxy in Puppeteer is straightforward. You pass the proxy server as an argument in the launch options:

JAVASCRIPT
const browser = await puppeteer.launch({
  args: ['--proxy-server=http://your-proxy-ip:port']
\});

If your proxy requires authentication, handle credentials at the page level:

JAVASCRIPT
await page.authenticate({
  username: 'your-username',
  password: 'your-password'
});

Every request the browser makes will go through that proxy until you close the instance. For any serious scraping, though, you'll need rotating proxies.

Also Read: How to Scrape LinkedIn Jobs


How to Use Rotating Proxies with Puppeteer

How to Use Rotating Proxies with Puppeteer

A static proxy gets blocked fast on repeated requests. Rotating proxies fix this by assigning a new IP to each session, so the target site never sees the same source twice.

The cleanest approach is to open a new browser instance per session. Most providers give you a single endpoint that handles rotation automatically:

JAVASCRIPT
onst browser = await puppeteer.launch({
  args: ['--proxy-server=http://rotating-proxy-endpoint:port']
\});

const page = await browser.newPage();

await page.authenticate({
  username: 'your-username',
  password: 'your-password'
\});

await page.goto('https://target-site.com');
await browser.close();

Closing the browser after each session forces a fresh connection and triggers a new IP from the pool. Residential proxies work best here since they're assigned by real ISPs and are nearly impossible for sites to flag. Residential proxies start at $1.75/GB with no subscription required.


How to Test Your Proxy Setup

How to Test Your Proxy Setup

Before running your scraper, it's worth confirming your proxy is actually working. The quickest way is to make a request to an IP-checking service and log the response:

JAVASCRIPT
const browser = await puppeteer.launch({
  args: ['--proxy-server=http://your-proxy-ip:port']
\});

const page = await browser.newPage();

await page.authenticate({
  username: 'your-username',
  password: 'your-password'
\});

await page.goto('https://api.ipify.org?format=json');
const content = await page.content();
console.log(content);
await browser.close();$

If the IP in the response is different from your real IP, the proxy is working. If it matches your real IP, something in your configuration is off. Check that the proxy URL and port are correct and that your credentials are being passed at the page level, not in the launch URL.

For rotating proxies, run this a few times and check that the IP changes between sessions. If you're getting the same IP every time, the browser instance isn't being closed and reopened between requests.

Also Read: Best Residential Proxy Providers


Final Words

Setting up a proxy in Puppeteer takes just a few lines of code. Match your proxy type to your target, close browser instances between sessions, and pace your requests. Proxyon's residential proxies start at $1.75/GB with no subscription required, deposit $5, and start scraping in minutes at Proxyon.

Frequently Asked Questions

Got questions? We have answers.

What is a proxy server and how does it work?

A proxy server is an intermediary between your device and the internet. Your requests route through the proxy's IP address, so target sites see the proxy instead of your real IP — enabling privacy, geo-targeting, and large-scale data collection.

How do I configure a proxy server on my device?

Our comprehensive guide simplifies proxy server configuration on any device. Follow our step-by-step instructions for seamless setup. Get secure and private internet access today.

Can using a proxy improve my internet speed?

In some cases, yes. Proxies can cache content and route traffic through faster paths, reducing latency. For scraping workloads, rotating proxies prevent rate limiting that would otherwise slow your jobs down.

Are proxies legal to use in all countries?

Using proxies for legitimate purposes is legal in most countries. You must comply with applicable laws and the terms of service of any sites you access.

Get back to building.

We'll handle the proxies.