Published on

How to use HTTP or HTTPS Proxy in Puppeteer


When automating things or web scraping, you might need to use a proxy to bypass and perform certain actions.

Let's see how to use HTTP proxy in the Puppeteer script


When using a proxy, we need to take care of a lot of things like authentication.

To avoid doing everything manually, we'll be using proxy-chain

npm install proxy-chain

Also, we'll need the proxy address (along with its authentication) which you can get it from your proxy provider.


import puppeteer from 'puppeteer';
import proxyChain from 'proxy-chain';

const proxyUrl = 'http://username:password@host:port';

const newProxyUrl = await proxyChain.anonymizeProxy(proxyUrl);

const browser = await puppeteer.launch({
    args: [`--proxy-server=${newProxyUrl}`]
// reset of the code ...

Happy using proxies!