Skip to content

Fix: wire GSTACK_CHROMIUM_PATH into headless launch, forward proxy config, and trust custom CA - #2457

Closed
erangini-ai wants to merge 1 commit into
garrytan:mainfrom
erangini-ai:fix/headless-browse-gstack-path
Closed

Fix: wire GSTACK_CHROMIUM_PATH into headless launch, forward proxy config, and trust custom CA#2457
erangini-ai wants to merge 1 commit into
garrytan:mainfrom
erangini-ai:fix/headless-browse-gstack-path

Conversation

@erangini-ai

Copy link
Copy Markdown

Summary

On sandboxed hosts (e.g., Claude Code web/remote) where Playwright's Chromium download is blocked, gstack bundles a pre-installed Chromium and sets GSTACK_CHROMIUM_PATH. However, only headed /browse (launchHeaded()) actually used that variable — headless /browse (launch()) ignored it entirely, still hitting the "Executable doesn't exist" error.

This PR fixes that, plus two related proxy/Certificate Authority gaps that prevent the browser from functioning inside MITM-proxied environments.

Changes

  1. Wire GSTACK_CHROMIUM_PATH into headless launch
    launch() now reads GSTACK_CHROMIUM_PATH and passes it as executablePath when set, matching the existing launchHeaded() behavior. Falls back to Playwright's default when the variable is absent.

  2. Forward HTTPS_PROXY to Chromium
    The browser process now passes --proxy-server=<value> (derived from HTTPS_PROXY) so outbound traffic routes through the session's proxy instead of attempting a direct connection.

  3. Trust the proxy's custom Certificate Authority
    Added ignoreHTTPSErrors: true (Playwright‑level) so the browser accepts certificates injected by the MITM‑style proxy. Also sets NODE_EXTRA_CA_CERTS for the Node process's own TLS stack (has no effect on Chromium itself, but useful for other network calls in the same context).

Testing

Verified in a proxy‑restricted Firecracker VM using a file:// URL (zero external network dependency):

  • Headless /browse navigates and renders successfully — no "Executable doesn't exist" error.
  • Headed /browse (xvfb‑run) passes the same test, no Chromium download attempted.
  • The --proxy-server flag is confirmed present in the launched Chromium command line.

Real‑internet navigation remains subject to the host's outbound network policy; this fix is focused solely on eliminating the browser‑launch failure.

… and trust custom CA

launch() (headless) ignored GSTACK_CHROMIUM_PATH entirely, unlike
launchHeaded() — sandboxed hosts (Claude Code web/remote) that pre-install
a pinned Chromium and block Playwright's own download would still fail
with "Executable doesn't exist" on default (headless) /browse.

Also forward HTTPS_PROXY as --proxy-server so the browser process routes
through the session's outbound proxy instead of attempting a direct
connection, and set ignoreHTTPSErrors (the Playwright-level equivalent —
Chromium has no CA-file trust flag) so it accepts a MITM-style proxy's
injected certificate. NODE_EXTRA_CA_CERTS is set alongside for this
process's own TLS stack, though it has no effect on Chromium itself.

Verified via file:// URL (no external network dependency): both headless
and headed launch and render without the executable error. Real internet
navigation is still bounded by whatever the host's outbound network
policy allows — this fix only removes the browser-launch failure.
@trunk-io

trunk-io Bot commented Aug 4, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@trunk-io

trunk-io Bot commented Aug 5, 2026

Copy link
Copy Markdown

An error occurred while submitting your PR to the queue: Only users that are a part of this repo's Trunk organization or have write permissions to the repo can submit a PR to the queue

@garrytan

Copy link
Copy Markdown
Owner

Closing: this was absorbed or superseded on main by v1.67.0.0 or earlier (see the v1.67 tracker-wave receipts in PR #2604). Thank you!

@garrytan garrytan closed this Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants