Skip to content

Respect HTTPS_PROXY / HTTP_PROXY env vars for backend outbound fetches #30

Description

@aitrace-dev

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

  • At backend startup, if HTTPS_PROXY / HTTP_PROXY / ALL_PROXY is set, configure undici with a ProxyAgent
  • Respect NO_PROXY for excluded hosts
  • Log a single line at startup: Outbound proxy enabled: <sanitized-url> — redact any auth credentials from the URL before logging
  • Vitest using a tiny in-process HTTP proxy (e.g. proxy-chain or a minimal http.createServer) verifies outbound fetch flows through it
  • CONTRIBUTING.md or a new docs/proxy.md documents the env vars

Pointers

  • packages/backend/src/index.ts (startup)
  • New packages/backend/src/proxy.ts + test

Difficulty

~2–3 hours.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions