Back to Knowledge Hub
Network

Puppeteer Proxy Setup: Which Input Actually Routes Traffic

A Puppeteer proxy that never takes effect used the wrong input. Separate the launch option that does not exist, the download-only variables and the browser switch.

BotBrowser Team

Documentation

Want the structured docs for Network?

This article lives in the editorial library. For step-by-step setup, reference material, and ongoing updates, jump into the docs section.

A language-neutral map of three Puppeteer inputs. A proxy object is not part of LaunchOptions, HTTP_PROXY covers the browser download, and --proxy-server in args reaches the browser. Only the last one routes page requests, and even then the resolver answers PROXY or DIRECT per request.

A Puppeteer proxy problem usually starts with a script that looks correct and an exit address that is the host's own. The reason is almost never a broken proxy server. Puppeteer exposes several inputs that a reader treats as interchangeable, and only one of them configures the browser that loads pages. Picking the wrong one produces a script that runs, logs nothing unusual, and never touches the proxy. BotBrowser documents the proxy settings a profile accepts and how to verify the egress a session used, and it cannot make a proxy server exist, repair a rejected credential or change what a remote service decides.

Three inputs are involved, and they reach three different places. A proxy object is not part of Puppeteer's documented launch options at all. The HTTP proxy environment variables configure the package's own browser download. The --proxy-server switch, forwarded through the launch arguments, is the one that reaches the browser process. Reading the difference is what turns a silent no-op into a one-line fix.

Everything below comes from the Puppeteer API and configuration pages, the Chromium proxy documentation, the headless-mode page and the BotBrowser proxy page. No proxy credential, customer address or target-site response appears anywhere in it.

TL;DR

  • LaunchOptions documents args and a headless modifier, and no proxy property; a proxy object passed at launch is not configuring the browser.
  • HTTP_PROXY, HTTPS_PROXY and NO_PROXY are documented as settings "used to download and run the browser", which is the package's download path rather than page traffic.
  • The switch that configures browser routing is --proxy-server, forwarded in the args array like any other Chromium command line argument.
  • A single --proxy-server value fills the "other proxies" slot and leaves the per-scheme entries empty, so a scheme-specific assumption can be wrong even when the proxy works.
  • An unreachable proxy fails requests with ERR_PROXY_CONNECTION_FAILED unless the value includes a direct:// fallback; adding that fallback trades a hard failure for a silent direct connection.
  • Chromium resolves a proxy per request, so a page that loads is not proof that the request used the proxy.

Contents

The launch option that does not exist

The Puppeteer LaunchOptions reference lists the properties a launch accepts. args is documented as "additional command line arguments to pass to the browser instance", and headless as taking true for the new headless mode or 'shell' for the old headless shell. The documented property list contains no proxy property.

That absence explains the most common failure on this topic. A script written against another automation library's shape passes a proxy object and receives no error, because an unrecognized property is simply ignored. The browser starts with no proxy configuration, every request goes direct, and the only symptom is an exit address the operator did not expect.

The check is cheap and does not require running anything. Read the launch call and ask whether the proxy appears inside args. If it appears as a sibling property of args, the browser never received it.

The environment variables that only cover the download

The second input is the environment. The Puppeteer configuration guide documents HTTP_PROXY, HTTPS_PROXY and NO_PROXY as environment options that "define HTTP proxy settings that are used to download and run the browser", and notes that using them for that purpose requires the optional proxy-agent peer dependency.

That sentence is about the package fetching a browser build. It describes the download path, not the network stack of the browser process that later loads a page. Setting HTTPS_PROXY in a shell and expecting page traffic to follow it is a category error, and it fails quietly: the download succeeds through the proxy, the launch succeeds, and the page requests still leave directly.

The distinction matters more than the wording, because the two paths can disagree without any visible conflict. A CI job that sets HTTPS_PROXY to reach a mirror will download the browser through that mirror and then run page traffic with no proxy at all. Both halves look configured if the reader only checks that the variable is set.

The switch that actually reaches the browser

The third input is the switch the browser itself understands. Chromium's proxy documentation describes manual proxy settings supplied at launch with --proxy-server=XXX, accompanied optionally by a second switch that carries the exclusion rules. In Puppeteer that value travels in args, which is exactly what args is documented to carry.

Three properties of that document decide what a reader should expect afterwards. The switch takes a server identifier rather than a bare host and port, so an omitted scheme is a decision with consequences. A single value can list more than one server, separated by commas, which is how the documented direct:// fallback is expressed. And the mapped form lets different URL schemes point at different servers, which is the form to reach for when one scheme genuinely needs a different route from the rest.

Those three properties also explain a class of report that looks like a proxy bug and is not. An operator supplies the mapped form with one scheme filled in and treats it as a global setting, then finds that requests for the other schemes went somewhere else entirely. Nothing failed; the configuration said exactly what it meant, and the reader had assumed a different default.

Two details in that document catch readers who assume a single value covers everything. First, one --proxy-server value fills the catch-all "other proxies" slot and no per-scheme entry exists, so every scheme falls back to it unless an explicit mapping overrides it. Second, an unreachable proxy fails requests with ERR_PROXY_CONNECTION_FAILED, and the documented remedy is to append a direct:// fallback:

--proxy-server="http://proxy-a:8080,direct://"

That fallback is worth understanding rather than copying. It converts a loud failure into a quiet direct connection, which is useful for resilience and lethal for a test that is supposed to prove the proxy was used. A run configured this way can pass every assertion while never touching the proxy, and the only observable is the exit address.

The per-scheme form is documented too, and it is the right shape when one scheme needs one proxy and the rest need another:

--proxy-server="http=https://proxy-a:443;socks=socks5://proxy-b:1080"

Choosing between the plain and the per-scheme form is a routing decision, and it has to be made before the run, not inferred from a log afterwards.

What a configured proxy still does not guarantee

Once the switch is in the right place, the third question is which requests used it. Chromium resolves a proxy per request, so the configured value is one input to a decision rather than a filter every request passes through. The documentation names the exclusion rules that accompany manual settings, and each of them can send a specific request direct.

The evidence that separates these cases is small and specific. Record the browser process command line and confirm the switch is in it, then record the resolver's answer for the request that mattered. A note that says "launched with --proxy-server, request to the API host resolved PROXY, exit address matched the provider" is complete. A note that says "proxy configured" is not, because the same words describe a script that never passed the switch and a script that did.

What changes when the browser runs headless

Nothing about the proxy input. Headless is a launch mode of the same browser selected with a flag, and the headless-mode page records that since Chrome 112 the browser creates platform windows without displaying them and that all other functions are available with no limitations. The proxy switch is one of those other functions, so a script that passed --proxy-server before adding a headless modifier keeps passing it afterwards.

The practical consequence is a rule about when to suspect the mode. If page requests stop using the proxy at the same moment a headless modifier is added, and the args array still contains the switch, the mode is a poor explanation and the environment the session reads is a better one. If the args array lost the switch in the same edit, the mode was never the question.

Why the three inputs get confused

The three inputs share a word and nothing else, which is why they get swapped. Each is called "proxy configuration" somewhere in its own documentation, each is set in a different place, and two of them produce no error when they are wrong for the job. A property the library ignores and an environment variable that covers a different path both leave the browser without a route, and neither one complains.

That is the argument for checking the artifact rather than the configuration. A script that reads correctly can be wrong in three different ways, and the only input that answers the question is the launched process command line plus the resolver's decision. Reading those two records costs less than reading three pages of documentation for the fourth time.

A short record that settles the question

Four fields cover almost every case, and each one is a value rather than a judgement. The launched command line answers whether the switch arrived. The scheme map in that command line answers which traffic it was meant to cover. The resolver's answer for the failing request answers which route it actually took. The observed exit answers whether the route matched the provider.

FieldHow to read itWhat it rules out
Launched command lineSearch it for the server switchA script that never passed the switch at all
Scheme map in the valueCheck which schemes the entry coversRequests sent to a different server than expected
Resolver answer for the requestPROXY or DIRECT for that destinationAn exclusion rule that sent the request direct
Observed exitCompare with the provider's published addressA proxy that received the request but egressed elsewhere

Two of those fields are produced before the page makes a request and two after, which is why the table is worth filling in order rather than all at once. The first pair explains a configuration that could not have worked; the second pair explains a configuration that could have worked and did not. Collapsing them into a single "proxy configured" note loses the distinction that decides the next step.

The table also keeps a common false conclusion in check. A working exit that matches the provider does not establish that the request the reader cares about used it, because the resolver answers per request. The reverse is equally true: a request that skipped the proxy does not prove the switch was missing, because an exclusion rule produces the same observation from a perfect configuration.

Writing the four fields down also makes the next run cheaper. A later failure that changes only the resolver answer points at an exclusion rule or a per-scheme mapping; a later failure that changes the launched command line points at the script. Without the record, both look like the same report, and the investigation restarts from the beginning each time.

BotBrowser capability and limitation

BotBrowser's proxy configuration documentation documents the settings a profile accepts and treats verification of the egress as an observation separate from the configuration that was requested. For this topic that separation is the useful part: the session's actual exit can be inspected rather than inferred from a launch option that may never have arrived.

The limitation belongs in the same sentence. BotBrowser cannot make a proxy server exist, cannot repair a rejected credential, and cannot change what a remote service decides about a request. It also cannot make an ignored launch property take effect: if a script passes its proxy to a place the browser never reads, no profile setting recovers it.

The sources divide the work the same way. The Puppeteer LaunchOptions page defines which properties a launch accepts, the configuration guide defines what the environment variables cover, and the Chromium proxy documentation defines what the switch does once the browser receives it. None of them can assert which path a particular request took in an operator's environment.

FAQ

Does Puppeteer accept a proxy option at launch?

The documented LaunchOptions property list contains no proxy property. Proxy configuration reaches the browser as a Chromium switch inside args; a proxy object passed beside it is ignored.

Why does HTTPS_PROXY not change my page requests?

Because it is documented for the package's browser download, not for the launched browser's network stack. It can make the download succeed through a proxy while page traffic continues to leave directly.

Which argument should I pass?

--proxy-server inside args. Use the plain form for one proxy for everything, and the documented per-scheme form when one scheme needs a different proxy from the rest.

Why did adding a direct:// fallback make my test pass while the proxy was down?

Because that fallback is what the fallback is for: it lets requests continue directly when the proxy is unreachable. A run that must prove the proxy was used should not carry a silent direct fallback, or it must record the resolver's answer as well.

What should a note about this setup contain?

The launched browser command line, the resolver's answer for the request that mattered, and the exit the session actually used. Those three records separate a missing switch from a request that skipped the proxy from a working proxy.

For neighbouring work, Puppeteer proxy: auth, SOCKS5 and browser signals continues from a proxy that already routes traffic, and headless browser proxy: what actually changes holds the client constant and varies the mode. Proxy configuration overview maps which settings apply at which scope.

Sources

Practical conclusion

Ask the three questions in order. Does the proxy appear inside the launch args array, which is the only one of the three inputs that reaches the browser process. Which requests did the resolver send through it, which the per-scheme mapping and the exclusion rules answer. And did the exit the session used match the provider, which the egress observation answers.

Reading a script this way takes a minute and settles the case that produces most of these reports, where a proxy object sat beside args and the browser never saw it. Once the switch is in the right input, the remaining questions are the ordinary routing ones, and a recorded resolver answer is what keeps them from being guessed.

#Puppeteer Proxy#Puppeteer Proxy Server#Puppeteer Proxy Auth#Puppeteer Socks5#Browser Automation

This article is part of the guide: Proxy Configuration Overview: A Browser Network Decision Map

Run the same check in BotBrowser

Load a profile, keep the signals you just read about consistent inside the browser, and confirm the result on your own machine before a rollout.