The proxy guide told users a proxy could live in a project or `$DSH_HOME` `.env`. It could not: `loadLayeredEnv` refuses the four proxy names from any discovered file, as it refuses `PATH` and `NODE_OPTIONS`, and the launch fails with a pointer to `export`. That refusal is right for the invoking directory's file — it arrives with a clone, and a repository must not choose where the harness sends its traffic — and wrong for the user's own `$DSH_HOME/.env`, which already holds their API key. `readEnvLayer` now accepts `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, and `NO_PROXY` from the directory that is the Harness home, and nowhere else. `DSH_HOME` is itself bootstrap-only, so no `.env` can relocate the exemption; the CA and TLS names in the same group stay refused everywhere, since they change what is trusted rather than where traffic goes. A project `.env` that sets a proxy name still fails the launch, and its message now names the home file as the second way out. Launching from inside the home directory reads that one file as the project layer; the exemption follows the directory. The seven existing refusal cases all write to the project layer and pass unchanged. Four new cases cover the home layer accepting both casings below an exported value, the home layer still refusing `SSL_CERT_FILE`, the project layer's new message, and the same-directory launch. The guide, both package READMEs, and the two Agent Notes that stated the old rule now state this one.
5.7 KiB
Run DSH behind a network proxy
English | 中文
DSH routes its outbound requests — model calls, web search, page fetches, and MCP servers over HTTP — through the proxy named by the standard proxy environment variables. It reads them at launch; nothing else needs configuring. A few paths stay direct by design or by runtime limit, listed under "What stays direct" below.
Export the variables
export HTTPS_PROXY=http://127.0.0.1:7890
export HTTP_PROXY=http://127.0.0.1:7890
Put both lines in your shell profile so every dsh invocation inherits them, or in $DSH_HOME/.env (~/.dsh/.env by default) next to your API key; an exported variable always wins over that file. A project's own .env cannot set them: it arrives with git clone, and DSH refuses to start rather than let a repository decide where your traffic goes.
A proxy that needs credentials takes them in the URL: http://user:password@proxy.example:8080. DSH never prints the URL back: a diagnostic names the variable it rejected, so neither the username nor the password appears anywhere.
Why your browser is proxied but your terminal is not
This is the most common surprise, and it is not specific to DSH. There is no single "system proxy" that all software obeys — there are three unrelated mechanisms:
| Mechanism | Who follows it |
|---|---|
| The operating system's proxy settings | Safari, most native macOS apps, Chrome and Edge |
The HTTP_PROXY / HTTPS_PROXY environment variables |
curl, git, npm, pip, and DSH |
| TUN mode (a virtual network interface) | Everything, transparently |
The "system proxy" switch in a proxy application such as Clash writes only the first one. Browsers pick it up; command-line tools never see it. That is why exporting the variables is a separate step, and why turning on TUN mode makes both work without any variables at all.
DSH does not read the operating system's proxy settings. Export the variables, or use TUN mode.
Choose what stays direct
NO_PROXY lists hosts to reach directly:
export NO_PROXY=internal.example.com,.corp.example.com,registry.local
An entry names a host and matches it together with every subdomain under it: NO_PROXY=example.com also sends api.example.com direct. A leading . or *. is accepted and means the same thing. An entry may carry a :port, and * bypasses everything.
CIDR ranges do not work. An operating system bypass list often contains entries like 10.0.0.0/8 or 192.168.0.0/16; copying those into NO_PROXY has no effect. Use host names or domain suffixes instead.
You do not need to list localhost or 127.0.0.1. DSH always bypasses loopback, because its own Web UI and local servers would otherwise route through the proxy and loop.
Limits worth knowing
SOCKS proxies are not supported. A socks5:// value is reported at startup and skipped, and DSH connects directly for the scheme that named it — setting HTTPS_PROXY=socks5://… alongside a usable HTTP_PROXY leaves https: direct rather than borrowing the HTTP proxy. Point the variables at your proxy application's HTTP port instead — most expose both, and the HTTP one is usually a neighbouring port number.
ALL_PROXY alone is enough. DSH falls back to it for both schemes, even though Node and curl differ on this. Setting HTTPS_PROXY explicitly is still clearer.
A TLS-intercepting corporate proxy needs its certificate. If requests fail with a certificate error once the proxy is reachable, point Node at your organisation's CA bundle before launching:
export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem
Node reads that variable only at process start, so export it before running dsh.
Tools DSH runs for you follow the same proxy. Commands in the bash tool, git, gh, and MCP servers started as child processes all inherit these variables. A child that is itself a Node program honors them only on Node 22.21 or later; an older Node connects directly.
A password in the proxy URL reaches those tools too. HTTPS_PROXY=http://alice:s3cret@proxy.example:8080 is a normal environment variable, so every command DSH runs — including the ones the model writes — can read it, and a command that prints its environment puts the password in output that is kept. This is how the variable already behaves for everything else in your shell. If that matters, give the proxy a credential-free entry point, or authenticate it some other way than in the URL.
What stays direct
Not every request DSH makes goes through the proxy:
- Anything on this machine. Loopback is always direct:
localhost, the whole127.0.0.0/8range,::1, and0.0.0.0. A proxy cannot usefully reach a service that only listens locally. - Code the model writes. The workflow and code-runtime workers never receive the proxy settings, so a script the model authors cannot read a proxy URL that may carry a password. Such a script reaches the network only if it configures that itself.
- Usage telemetry. The OTLP exporter uses Node's own HTTP client rather than the one a proxy configures, so telemetry connects directly and simply fails where direct egress is blocked. Nothing you do in DSH depends on it. Set
DSH_TELEMETRY_MODE=DISABLEDto turn it off entirely. web_fetchto a literal private address. A URL naming an address likehttp://10.0.0.5/is refused rather than handed to the proxy, the same refusal it gets with no proxy configured.
Check that it worked
Ask the agent to fetch a page and watch your proxy application's connection log:
dsh --profile headless "fetch https://example.com and tell me the page title"
If the request does not appear there, confirm the variables survive into DSH's own environment:
env | grep -i proxy