Repository navigation
Proxy support: --proxy, HTTPS_PROXY / NO_PROXY - #66
Merged
Merged
Conversation
…NO_PROXY A routing agent replaces Node's global HTTP(S) agents and picks the proxy per URL (CONNECT for https), so axios, uploads and the tunnel download follow it; the live-updates WebSocket gets it explicitly and --tunnel passes it to the tunnel as --proxy/--proxy-userpwd. The third-party connectivity pre-check is skipped behind a proxy, where it failed before any request. axios's own env proxy handling is turned off: it sends https requests to the proxy without CONNECT.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 3 of the follow-up list. This PR is independent of #63 and #65 and is based on
main.Why
Behind a corporate proxy the CLI failed before uploading anything:
fetch, which ignoresHTTPS_PROXY. It reported "No internet connection" and stopped.What
src/utils/proxy.ts:agent-base+https-proxy-agent/http-proxy-agentv7, which are CommonJS; v9 is ESM-only) picks the proxy for each URL.http.globalAgentandhttps.globalAgent, and setsaxios.defaults.proxy = false.--proxy <url>, a program-level option accepted before or after the subcommand. It applies to every URL.HTTPS_PROXYfor https URLs andHTTP_PROXYfor http URLs, withALL_PROXYas a fallback. Lower-case names work too.NO_PROXYsupports hosts,.domainand*.domainsuffixes,:portand*.host:portis read ashttp://host:port.proxyAgent()explicitly, becausewsbypasses the global agent.--tunnel, the tunnel (a separate Java process) gets--proxy host:portand--proxy-userpwd. The tunnel jar download already follows the global agent.--quietor--json). HTTP 407 maps to "Proxy authentication required", with hints.Tests
tsc, eslint and prettier pass.jest: 878 passed.tests/utils/proxy.test.tscovers the env/NO_PROXY rules and redaction. It also starts a real proxy on 127.0.0.1 that records what reaches it and refuses every CONNECT, so nothing leaves the machine. Through it, the tests confirm:CONNECT api.testingbot.com:443withProxy-Authorization;https.get(the tunnel download) uses the proxy;CONNECT hub.testingbot.com:443.--proxyworks before and after the subcommand,HTTPS_PROXY=socks5://…is rejected, and the password is masked in "Using proxy".Not tested: a full run through a real corporate proxy against production. Worth one manual run before release, for example
HTTPS_PROXY=… testingbot devices.