Skip to content

feat(browse): Honor system proxy env vars (HTTPS_PROXY / BROWSE_PROXY) for chromium launch#1263

Closed
rssprivacy-commits wants to merge 1 commit intogarrytan:mainfrom
rssprivacy-commits:feat/proxy-env-support
Closed

feat(browse): Honor system proxy env vars (HTTPS_PROXY / BROWSE_PROXY) for chromium launch#1263
rssprivacy-commits wants to merge 1 commit intogarrytan:mainfrom
rssprivacy-commits:feat/proxy-env-support

Conversation

@rssprivacy-commits
Copy link
Copy Markdown

@rssprivacy-commits rssprivacy-commits commented Apr 28, 2026

Summary

Adds proxy support to gstack browse by passing system proxy env vars
through to Playwright's chromium.launch({ proxy: ... }) option.

Without this, users behind a corporate/VPN proxy see
ERR_TUNNEL_CONNECTION_FAILED or ERR_SSL_UNRECOGNIZED_NAME_ALERT
when navigating to public URLs — Playwright does not auto-read
HTTPS_PROXY for chromium launch.

Behavior

  • Reads BROWSE_PROXY (priority) → HTTPS_PROXYHTTP_PROXY from env
  • Reads NO_PROXY for bypass list
  • Passes them via Playwright's first-class proxy launch option
  • Zero effect when no proxy env vars are set (fully backward-compatible)

Why a separate BROWSE_PROXY override?

Some environments (mihomo/clash with mixed-port + fakeip / TUN mode)
make the system HTTP proxy resolve DNS to fake addresses locally, then
forward via HTTP CONNECT. Chromium honors that and sends fakeip in the
CONNECT line, which the proxy can't route.

BROWSE_PROXY=socks5://host:port lets the user opt into SOCKS5 protocol,
which does remote DNS at the proxy — bypassing the fake IP. The standard
HTTPS_PROXY path is preserved for regular HTTP proxies.

Test plan

  • No proxy env: chromium launches as before, no behavior change
  • HTTPS_PROXY=http://corp-proxy:8080: chromium routes through it
  • BROWSE_PROXY=socks5://127.0.0.1:1082 in mihomo + fakeip env:
    navigation succeeds (verified end-to-end with public TLS sites)
  • NO_PROXY=localhost,127.0.0.1: bypass list applied via Playwright

Diff

13 lines added in browse/src/browser-manager.ts. No changes elsewhere.


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Playwright's chromium.launch() does not auto-read HTTPS_PROXY/HTTP_PROXY
environment variables — they must be passed explicitly via the `proxy`
launch option. Without this, users behind a corporate/VPN proxy see
ERR_TUNNEL_CONNECTION_FAILED or ERR_SSL_UNRECOGNIZED_NAME_ALERT errors
when navigating to public URLs.

This change reads the system proxy from environment and passes it through
to Playwright's launch options. Backward-compatible: zero effect when no
proxy env vars are set.

Adds a new optional `BROWSE_PROXY` env var (takes priority over standard
HTTPS_PROXY) to support fakeip/TUN environments where the HTTP proxy
resolves DNS locally to fake addresses. Setting BROWSE_PROXY to a
socks5://host:port URL forces remote DNS resolution at the proxy,
bypassing the fake IP issue. Common scenario: mihomo/clash with
mixed-port + fakeip mode (the user must opt in via socks5:// URL).

Tested in a fakeip + mihomo mixed-port (1082) environment:
- HTTPS_PROXY=http://127.0.0.1:1082 → still fails (HTTP CONNECT carries
  fakeip in destination)
- BROWSE_PROXY=socks5://127.0.0.1:1082 → succeeds (SOCKS5 sends hostname,
  proxy resolves remotely)
@garrytan
Copy link
Copy Markdown
Owner

Thanks @rssprivacy-commits — closing as deferred. System proxy env handling has been partially addressed in v1.30 (#1391); if a specific gap remains on current main, a focused PR with the missing case would land easier.

@garrytan garrytan closed this May 10, 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.

2 participants