Context
Users on corporate networks need outbound LLM API calls to go through an HTTP(S) proxy. Node's native fetch does not honor HTTPS_PROXY by default — it needs to be wired up explicitly.
The cleanest approach is undici.setGlobalDispatcher(new ProxyAgent(...)) at backend startup when the env var is set.
Acceptance criteria
Pointers
packages/backend/src/index.ts (startup)
- New
packages/backend/src/proxy.ts + test
Difficulty
~2–3 hours.
Context
Users on corporate networks need outbound LLM API calls to go through an HTTP(S) proxy. Node's native
fetchdoes not honorHTTPS_PROXYby default — it needs to be wired up explicitly.The cleanest approach is
undici.setGlobalDispatcher(new ProxyAgent(...))at backend startup when the env var is set.Acceptance criteria
HTTPS_PROXY/HTTP_PROXY/ALL_PROXYis set, configureundiciwith aProxyAgentNO_PROXYfor excluded hostsOutbound proxy enabled: <sanitized-url>— redact any auth credentials from the URL before loggingproxy-chainor a minimalhttp.createServer) verifies outbound fetch flows through itCONTRIBUTING.mdor a newdocs/proxy.mddocuments the env varsPointers
packages/backend/src/index.ts(startup)packages/backend/src/proxy.ts+ testDifficulty
~2–3 hours.