Skip to content

fix(cli): honor HTTP_PROXY/HTTPS_PROXY for Node.js native fetch#212

Open
dhruvkej9 wants to merge 1 commit into
githits-com:mainfrom
dhruvkej9:fix/proxy-aware-fetch
Open

fix(cli): honor HTTP_PROXY/HTTPS_PROXY for Node.js native fetch#212
dhruvkej9 wants to merge 1 commit into
githits-com:mainfrom
dhruvkej9:fix/proxy-aware-fetch

Conversation

@dhruvkej9

@dhruvkej9 dhruvkej9 commented Jul 7, 2026

Copy link
Copy Markdown

Problem

Node.js native fetch ignores HTTP_PROXY/HTTPS_PROXY by default. In corporate proxy environments (e.g. Zscaler), this causes connect timeouts like:

ConnectTimeoutError: Connect Timeout Error (attempted address: miehezlqamnzvrijcaff.supabase.co:443, timeout: 10000ms)

curl works in the same terminal because curl reads proxy env vars; Node does not.

Solution

Use undici's EnvHttpProxyAgent to globally configure Node native fetch when HTTP_PROXY/HTTPS_PROXY is present. This honors NO_PROXY too.

Changes

  • Add @githits/core-internal/shared/proxy-fetch.ts with configureProxyAwareFetch() / hasProxyEnv().
  • Call configureProxyAwareFetch() at the top of src/cli.ts before any network request.
  • Call configureProxyAwareFetch() inside createContainer() so MCP server and programmatic usage are covered.
  • Add unit tests in packages/core-internal/src/shared/proxy-fetch.test.ts.
  • Add undici ^8.5.0 dependency and update bun.lock.

Verification

  • bun run typecheck passes.
  • bun run lint passes (one pre-existing warning in src/commands/init/agent-definitions.ts).
  • bun test packages/core-internal/src/shared/proxy-fetch.test.ts src/container.test.ts passes.
  • bun run build succeeds.

Fixes timeout errors for users behind corporate proxies.

Node native fetch ignores proxy env vars by default. In corporate proxy
environments (e.g. Zscaler) this causes connect timeouts for all backend
calls because traffic bypasses the configured proxy.

- Add @githits/core-internal/shared/proxy-fetch with configureProxyAwareFetch()
  using undici EnvHttpProxyAgent to read HTTP_PROXY/HTTPS_PROXY/NO_PROXY.
- Call configureProxyAwareFetch() at the top of src/cli.ts before any network
  work, and inside createContainer() so MCP and programmatic usage are covered.
- Add unit tests for hasProxyEnv and configureProxyAwareFetch.
- Add undici ^8.5.0 as a dependency.
@dhruvkej9

dhruvkej9 commented Jul 7, 2026

Copy link
Copy Markdown
Author

@jlitola @skvark — please review when you have a moment. Happy to adjust based on feedback.

@jlitola

jlitola commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@dhruvkej9 I'm sorry but we don't have CLA in place and cannot yet accept external contributions. But I'll check if I could add support soonish.

You can also use GitHits with remote MCP which would hopefully unblock you right now: https://docs.githits.com/installation/manual-setup.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants