This week I set up tooling on a corporate Windows machine behind a local proxy — 127.0.0.1:7890, the standard arrangement for developers who need to reach blocked registries. Three tools needed network access. All three failed, and each one failed differently:
- Docker:
docker pull→context deadline exceededafter 17 seconds - npm: worked, but 8+ seconds per registry round-trip
- prebuild-install (the native-binary fetcher inside
sqlite3):Client network socket disconnected before secure TLS connection was established
Same machine. Same network. Same proxy. The reason is the one thing most "just set your proxy" tutorials skip: every tool decides for itself whether to honor the system proxy, read environment variables, or consult its own config file. "Setting the proxy on the machine" doesn't exist. You set it per layer.
Here's the decision tree I ended up with, followed by the layers explained.
The decision tree
A network-dependent tool fails on a proxied/censored network │ ├─ Step 0: Does the proxy itself work? │ curl -x http://127.0.0.1:7890 -sI https://registry.npmjs.org -m 8 │ ├─ 200 → proxy is fine; your TOOL is the problem (go to Step 1) │ └─ 000/connection refused → proxy isn't running / wrong port. Fix this first. │ ├─ Step 1: Which tool is failing? Proxy support is per-tool: │ │ │ ├─ npm / node scripts │ │ ├─ Reads: HTTPS_PROXY / HTTP_PROXY env vars, npm config │ │ ├─ Slow but working? → switch registry one-off: │ │ │ npm install <pkg> --registry=https://registry.npmmirror.com │ │ │ (no global config change, no side effects) │ │ └─ Totally blocked? → export HTTPS_PROXY=http://127.0.0.1:7890 │ │ │ ├─ Docker (docker pull) │ │ ├─ Reads: NOTHING from your shell. The daemon is a separate service. │ │ ├─ "context deadline exceeded" = daemon can't reach the registry │ │ └─ Fix: Docker Desktop → Settings → Resources → Proxies │ │ set HTTP/HTTPS proxy → Apply & Restart (restart required) │ │ │ ├─ prebuild-install / node-gyp fetchers (native binaries) │ │ ├─ Claim to read npm_config_proxy / HTTPS_PROXY — sometimes don't │ │ │ (my session: still died mid-TLS with proxy env set) │ │ └─ Reliable fallback: don't fight the tool. curl the binary │ │ from GitHub Releases yourself and drop it in place. │ │ │ └─ curl — always explicit, always honest: │ curl -x http://127.0.0.1:7890 -L -o file.tar.gz <url> │ └─ Step 2: It "works through the proxy" but behaves weirdly? ├─ Shared exit IP → GitHub API 403 rate limit │ {"message":"API rate limit exceeded for 203.190.x.x"} │ Workaround: scrape the HTML asset page instead of the API: │ https://github.com/<org>/<repo>/releases/expanded_assets/<tag> └─ You set a global proxy and localhost calls now break? → export NO_PROXY=localhost,127.0.0.1 (webhooks, local servers) Layer 0: establish ground truth with curl before touching anything
Every debugging session on a proxied network opens with the same question: is the proxy alive, and can it reach the target? Don't reason from the failing tool's output — tools muffle and relabel network errors, the same way a catch block turns "binary missing" into "package not found."
# Baseline: does the proxy work at all? curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" \ -x http://127.0.0.1:7890 https://registry.npmjs.org -m 8 # → 200 0.4s proxy fine, tool problem # Compare: direct connection curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" \ https://registry.npmjs.org -m 8 # → 200 8.0s direct works but throttled → mirror or proxy, either is fine The -m 8 matters more than it looks: on a broken route, a slow failure is worse than a fast one. And the gap between those two numbers tells you whether you're facing a reachability problem (use the proxy) or merely a throughput one (use a mirror).
curl earns its place here because it never lies about proxies. -x is explicit, per-command, and leaves no residue in any config file.
Layer 1: npm — the polite one
npm reads proxy configuration from multiple places and mostly behaves:
-
HTTP_PROXY/HTTPS_PROXYenvironment variables -
npm config(npm config set proxy http://...)
But before routing npm through a proxy, check whether you need one at all. On networks where the default registry is merely slow rather than blocked, the cleaner fix is a one-off registry flag:
npm install -g <pkg> --registry=https://registry.npmmirror.com Notice this is deliberately not npm config set registry. A one-off flag changes nothing persistent: your other projects keep their behavior, and you never find out six months later that some internal tool was quietly hitting a mirror. Persistent config is a decision. A flag is an experiment.
Layer 2: Docker — the daemon that ignores you
This was the most instructive failure of my week:
$ docker pull n8nio/n8n Unable to find image locally docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceeded (Client.Timeout exceeded while awaiting headers) My shell had the proxy exported. curl through the proxy worked fine. So why did Docker choke?
Because docker pull isn't executed by your shell. It's a request to the Docker daemon — a separate Windows service living in its own environment. Your export HTTPS_PROXY never reaches it. The daemon tries registry-1.docker.io directly, slams into the corporate firewall, and times out with context deadline exceeded — which, notice, is itself a relabeled error: the wording suggests a timeout problem, when the actual problem is "no route."
The fix lives in the daemon's settings, not your shell:
Docker Desktop → Settings → Resources → Proxies Manual proxy configuration: Web Server (HTTP) proxy: http://127.0.0.1:7890 Secure Web Server (HTTPS) proxy: http://127.0.0.1:7890 → Apply & Restart The restart is not optional. The daemon reads its proxy config at startup; change the settings on a running daemon and nothing changes until it comes back up.
One Windows-specific detail worth knowing: 127.0.0.1 in Docker Desktop's proxy settings correctly refers to the host machine. This is one of the few places where localhost-in-a-config "just works" for Docker on Windows.
Layer 3: prebuild-install — when the tool's proxy support betrays you
Native modules (sqlite3, bcrypt, canvas, sharp) download prebuilt binaries from GitHub Releases during npm install. When that download fails, npm install still exits 0. The failure detonates later, at runtime — I wrote a whole separate post about that trap.
The fetcher (prebuild-install) documents proxy support via npm_config_proxy / npm_config_https_proxy. In my session, with both set, it still died:
prebuild-install warn install Client network socket disconnected before secure TLS connection was established That message usually means the connection was reset mid-handshake — the signature of a direct connection to a blocked host, i.e. the proxy config never took effect for that request. Whether that's a bug in the version I had, or some subtlety about which env var it reads in which mode, I honestly can't say.
What I can say: the reliable move is to stop negotiating with the tool.
# 1. Find the real asset name (N-API naming, NOT node-vXXX — see below) curl -sSL "https://github.com/TryGhost/node-sqlite3/releases/expanded_assets/v5.1.7" \ | grep -o 'href="[^"]*"' | grep -i "win32-x64" # 2. Fetch it with curl, which you've already proven works curl -sSL -x http://127.0.0.1:7890 -o binding.tar.gz \ "https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz" # 3. Place it: the tarball contains build/Release/node_sqlite3.node, # so extract at the PACKAGE ROOT — not into build/Release tar -xzf binding.tar.gz -C .../node_modules/sqlite3 Ten minutes of curl beats an evening of spelunking through prebuild-install's source. Fallbacks are allowed to be manual.
The trap inside the trap: shared proxy exit IPs
After the TLS failures, I tried the GitHub API to look up release assets:
curl https://api.github.com/repos/TryGhost/node-sqlite3/releases/tags/v5.1.7 {"message":"API rate limit exceeded for 203.190.x.x. ..."} HTTP 403 The proxy's exit IP is shared, and anonymous GitHub API limits are per-IP. Somebody else on that exit node had burned through the quota. Two fixes: authenticate the request with a personal token, or — no auth, no rate limit — request the HTML fragment the release page renders its asset list from:
https://github.com/<org>/<repo>/releases/expanded_assets/<tag> Grep it for href= and you have every asset name. This has become my default on shared-IP networks, precisely because it skips the rate-limit conversation entirely.
Don't forget NO_PROXY
Once you export a proxy for a session — or launch a long-running tool with one — every request goes through it. Including the ones that shouldn't:
export HTTP_PROXY=http://127.0.0.1:7890 export HTTPS_PROXY=http://127.0.0.1:7890 export NO_PROXY=localhost,127.0.0.1 Without NO_PROXY, calls to your own local servers and webhooks (http://localhost:5678/...) get routed through the proxy, which slows them down at best and breaks them outright at worst. On a proxy whose exit IP isn't your machine, "localhost" stops meaning localhost. Two seconds of setup, and an entire class of "why is my local dev server suddenly weird" mysteries never happens.
The checklist (copy-paste diagnosis)
Next time a tool can't reach the network on a proxied machine, run these in order. By the end, you'll know which layer was lying to you:
# 1. Proxy alive and reaching the target? curl -x http://127.0.0.1:7890 -sI https://registry.npmjs.org -m 8 # 2. Direct route viable (slow counts as viable)? curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://registry.npmjs.org -m 8 # 3. npm: prefer a one-off mirror over global config changes npm install <pkg> --registry=https://registry.npmmirror.com # 4. Docker: the daemon needs its OWN proxy settings + restart # Docker Desktop → Settings → Resources → Proxies # 5. Binary fetchers that ignore proxy config → curl + tar, manually # 6. GitHub API 403 on a shared exit IP → use expanded_assets HTML # 7. Always: NO_PROXY=localhost,127.0.0.1 The one-sentence version of everything above: there is no such thing as "setting the proxy on this machine" — only per-tool proxy settings, so diagnose the tool, not the network.
