How to Setup Puppeteer for Web Scraping | 2026 Guide
TL;DR
A Puppeteer proxy is normally applied browser-wide with Chrome's --proxy-server launch argument. Every page in that browser process uses the route unless Chrome bypass rules say otherwise.
Authenticated HTTP proxies require a separate page.authenticate() call in common Puppeteer workflows. Keep the username and password in environment variables or a secret manager.
Verify the exit IP in the browser context before scraping the target. This catches bad credentials, bypass rules, and unexpected direct connections early.
One browser process maps naturally to one proxy endpoint. For multiple simultaneous exits, create bounded browser workers instead of changing the launch proxy on an existing browser.
Puppeteer should scrape only public or authorized pages at a respectful rate. A proxy does not override access controls, terms, robots directives, or privacy obligations.
What Does a Puppeteer Proxy Do?
A Puppeteer proxy routes Chrome's network traffic through an intermediary configured when the browser launches. The destination then sees the proxy exit IP, while Puppeteer still controls navigation, JavaScript execution, selectors, screenshots, and browser lifecycle. Nstproxy proxy infrastructure can supply the endpoint, but the Node.js application remains responsible for browser behavior and data handling.
Puppeteer controls Chrome or Chromium through its JavaScript API. Modern Chrome Headless shares the browser's core implementation, as explained in Chrome's Headless mode documentation. A browser is useful when the authorized page requires JavaScript rendering; use a direct HTTP client when the data is already available through a permitted API or static response.
You need a supported Node.js runtime, a current Puppeteer package, a Chrome installation supplied or recognized by that package, proxy connection values, and a public or authorized target.
mkdir puppeteer-proxy-demo
cd puppeteer-proxy-demo
npm init -ynpminstall puppeteer
The HTTP_PROXY, HTTPS_PROXY, and NO_PROXY variables described in Puppeteer's configuration guide apply to Puppeteer's browser download and execution configuration. To route page traffic predictably, pass Chrome's proxy launch argument.
How to Set Up a Puppeteer Proxy
Launch Puppeteer with --proxy-server to apply one endpoint to the browser process. Validate that PROXY_SERVER exists before starting Chrome.
The IP response should differ from a direct connection and match the expected region or provider. The ipify API reports the public address visible to the service; it does not prove that every other browser protocol follows the same route.
How to Authenticate a Puppeteer Proxy
For a username-and-password HTTP proxy, call page.authenticate() before navigation. Do not place the credential in the launch argument or log the environment object.
importpuppeteerfrom'puppeteer';const required =['PROXY_SERVER','PROXY_USERNAME','PROXY_PASSWORD'];for(const name of required){if(!process.env[name])thrownewError(`${name} is required`);}const browser =await puppeteer.launch({headless:true,args:[`--proxy-server=${process.env.PROXY_SERVER}`],});try{const page =await browser.newPage();await page.authenticate({username: process.env.PROXY_USERNAME,password: process.env.PROXY_PASSWORD,});await page.goto('https://api.ipify.org?format=json',{waitUntil:'domcontentloaded',timeout:30_000,});console.log(await page.evaluate(()=>document.body.innerText));}finally{await browser.close();}
Authentication errors commonly surface as net::ERR_INVALID_AUTH_CREDENTIALS or an HTTP 407. Confirm the endpoint protocol and the provider's generated username format before adding retries.
Take a Quick Look
Generate an Nstproxy endpoint, bind one deliberate session to each browser worker, and verify the browser's exit IP before visiting an authorized target.
A responsible Puppeteer scraping example should request a bounded public page, wait for a stable selector, extract only needed fields, and close the browser even when navigation fails.
example.com is reserved for documentation by IANA's example-domain policy. For a real project, replace the selector only after inspecting an authorized target and prefer stable semantic markup over generated class names.
Choosing Nstproxy for Puppeteer
Nstproxy Residential Prime Proxies fit Puppeteer jobs that need residential exits, selectable regions, or sticky sessions for multi-page authorized workflows. Puppeteer consumes the endpoint through Chrome's standard proxy configuration, so no provider-specific browser library is required. Nstproxy's current documentation describes Channels, gateway endpoints, country parameters, session duration, session IDs, and HTTP/HTTPS/SOCKS5 support. The combination suits public-page rendering, localization checks, ad verification, and price monitoring when the target permits automation. A proxy cannot guarantee access, and the script still needs bounded concurrency, navigation timeouts, and response validation.
Session controls: Keep the same documented session ID while a browser workflow depends on cookies or pagination state; change it between independent jobs when rotation is intended.
Residential Prime pricing: Package and pay-per-use options support different browser traffic profiles; verify current rates and transfer volume before selecting a plan.
Regional gateways: Choose the gateway nearest the worker to improve the connection leg, then request the exit country separately.
Protocol choice: HTTP/HTTPS is the simplest Puppeteer authentication path. Test SOCKS5 behavior on the exact Chrome build before standardizing it.
The broader proxy server tools guide compares browser automation with lighter HTTP clients, while the scraping proxy guide explains when residential, datacenter, or persistent ISP exits fit a workload.
Rotate Proxies Across Browser Workers
One launched browser has one --proxy-server value, so multiple concurrent exits should use separate browser processes or a purpose-built routing layer. Keep the pool small enough for the machine and target policy.
The example caps the pool at two workers. Production limits should account for memory, bandwidth, page weight, target rate limits, and the proxy plan. Do not create a new browser per URL if a compliant batch can reuse one browser and one stable session.
Reduce Browser Traffic Without Hiding Behavior
Request interception can skip large assets when the authorized extraction does not need them. Blocking images and fonts reduces transfer, but blocking scripts may change the page or remove the data being collected.
Register the request handler before navigation. Test the returned DOM after every change rather than assuming a lower byte count preserves correctness.
Troubleshooting Puppeteer Proxy Errors
Puppeteer proxy debugging should begin with a single IP-check page in a fresh browser process.
Symptom
Likely boundary
Check
ERR_PROXY_CONNECTION_FAILED
Host, port, firewall, or unavailable gateway
Validate endpoint spelling and connectivity from the worker
ERR_INVALID_AUTH_CREDENTIALS or 407
Proxy authentication
Call page.authenticate() before navigation and verify generated credentials
Page loads but IP is direct
Proxy argument missing or bypassed
Print launch arguments and test the IP endpoint inside the page
Navigation timeout
Slow route, heavy page, target behavior, or blocked resources
Test a light endpoint, increase timeout deliberately, and inspect request failures
Blank or incomplete extraction
Selector changed or JavaScript had not completed
Wait for a stable selector or relevant response instead of an arbitrary delay
Memory growth
Browsers or pages are not closed
Use finally blocks and cap simultaneous workers
Session breaks between pages
Exit rotates during stateful work
Reuse one provider session and browser for the sequence
Puppeteer's Page.goto API documentation describes navigation options and the response contract. Avoid treating every timeout as a proxy problem.
Responsible Web Scraping with Puppeteer
Puppeteer should collect only public or authorized data for a defined purpose. Review terms and robots guidance, identify the crawler when appropriate, honor rate limits, minimize retained fields, and provide a deletion or contact process for sustained collection.
Do not use proxy rotation to evade access controls, CAPTCHAs, account restrictions, or explicit denials. If a site offers an API or data export for the required information, prefer that supported interface.
Conclusion
Set a Puppeteer proxy at browser launch, authenticate each page before navigation, and verify the exit IP inside Chrome. Keep one proxy session for stateful work and use a small number of separate browser workers only when independent tasks require different exits. Reliable scraping depends on selectors, timeouts, lifecycle cleanup, and permission as much as it depends on the network route.
Experience Nstproxy — Start Your Free Trial Today
Begin with one headless browser and one IP-check navigation, then move the verified proxy session into a bounded, authorized Puppeteer job.
Pass --proxy-server=PROTOCOL://HOST:PORT in the args array of puppeteer.launch(). Start a new browser process when the proxy endpoint changes.
Q: How do I add proxy authentication in Puppeteer?
Call page.authenticate({ username, password }) before the first navigation for an authenticated HTTP proxy. Load both values from protected runtime configuration.
Q: Can each Puppeteer page use a different proxy?
Chrome's standard launch proxy is browser-wide, so separate endpoints normally require separate browser processes. A routing intermediary can provide finer control, but it adds another component to verify.
Q: Why is my Puppeteer proxy not changing the IP?
The launch argument may be missing, malformed, or bypassed, or the test may run outside the browser context. Navigate the Puppeteer page itself to an IP-check service and inspect the result.
Q: Should I rotate the proxy for every page?
No. Keep one session for related pages, cookies, and pagination; rotate only between independent units of work when the workflow and target policy allow it.
Q: Is Puppeteer web scraping legal?
Legality depends on the data, authorization, contract, jurisdiction, and intended use. Scrape only public or permitted pages, minimize data, and follow the site's applicable rules.
Marcus Chen
Aug. 7th 2026
110M+ real IPs with 99.9% access success
Blazing-fast average response ~0.5s for high-concurrency tasks
From only $0.1/GB
Get immediate access to premium residential, datacenter, IPv6 and ISP proxy pools.