Integrations · Automation & scraping

Use HProxy with Puppeteer.

Run headless Chrome through an HProxy proxy with Puppeteer and page.authenticate.

Puppeteer drives headless (or headful) Chrome from Node, the go-to for rendering-heavy scraping and automated testing in the JavaScript world.

Headless Chrome from a datacenter IP is a fingerprint sites recognise on sight. A residential exit removes the network half of that tell so the browser's behaviour is what gets judged.

Setting up HProxy in Puppeteer

  1. 1.Launch Chrome with --proxy-server pointing at your host and port.
  2. 2.Because the proxy needs a login, call page.authenticate() with your username and password before navigating.
  3. 3.Navigate as normal; the whole page load now goes through the proxy.
import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  args: ["--proxy-server=res.hproxy.com:8080"],
});
const page = await browser.newPage();
await page.authenticate({ username: "user-country-us", password: "pass" });
await page.goto("https://ipinfo.io/json");

Worth knowing

The username and password go through page.authenticate(), not the --proxy-server flag.

Frequently asked questions

Why does the proxy-server flag not accept my username and password?

Because that Chrome flag only takes a host and port. Credentials go through page.authenticate instead, called before you navigate. This is the single most common reason a Puppeteer proxy setup returns authentication errors that look like the proxy being wrong.

Do I need to authenticate on every page?

Yes. Authentication is set per page rather than per browser, so each new page you open needs the call before it navigates. Forgetting it on a second page produces a failure that looks intermittent and is entirely deterministic.

How do I give each Puppeteer page a different IP?

Launch a separate browser instance per identity rather than opening more pages, because the proxy flag is set at launch and pages within one browser share it. With a rotating proxy each new launch takes a fresh exit automatically.

How do I stop Puppeteer downloading images?

Enable request interception and abort requests whose resource type is image, font, media or stylesheet. It is the highest-impact change you can make on per-gigabyte billing, because a headless browser fetches all of it by default exactly as a real one does.

The host, port and login shown here are the format; your exact values are on your dashboard, ready to copy.

HProxy.

Ready when you are.Your dashboard is ten seconds away.

Get Startedor talk to us at support@hproxy.com
HProxy