[PR #10856] feat(opencode): add HTTP/HTTPS proxy support #13582

Open
opened 2026-02-16 18:18:25 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10856

State: open
Merged: No


Fixes #10227
Related: #9736, #8822

Summary

Bun's native fetch() ignores HTTP_PROXY/HTTPS_PROXY environment variables. This PR adds a proxyFetch wrapper that reads proxy configuration and passes it to Bun's fetch.

Changes

  • Add ProxyConfig schema in config.ts
  • Add proxyFetch wrapper in src/util/fetch.ts
  • Replace all fetch() calls with proxyFetch() across ~20 files
  • Support NO_PROXY patterns (wildcards, suffixes)
  • Add OPENCODE_DISABLE_PROXY emergency bypass flag
  • Add unit and integration tests
  • Add documentation in docs/proxy.md

Configuration

Environment variables:

export HTTPS_PROXY=http://proxy:8080
export NO_PROXY=localhost,*.internal.com

Or in opencode.json:

{
  "proxy": {
    "https": "http://proxy:8080",
    "no_proxy": ["localhost", "*.internal.com"]
  }
}

Verification

  • All 822 existing tests pass
  • Tested manually behind corporate proxy (France Travail)
  • Verified API calls go through proxy
  • Verified NO_PROXY bypass works for internal hosts
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10856 **State:** open **Merged:** No --- Fixes #10227 Related: #9736, #8822 ## Summary Bun's native `fetch()` ignores `HTTP_PROXY`/`HTTPS_PROXY` environment variables. This PR adds a `proxyFetch` wrapper that reads proxy configuration and passes it to Bun's fetch. ## Changes - Add `ProxyConfig` schema in config.ts - Add `proxyFetch` wrapper in `src/util/fetch.ts` - Replace all `fetch()` calls with `proxyFetch()` across ~20 files - Support `NO_PROXY` patterns (wildcards, suffixes) - Add `OPENCODE_DISABLE_PROXY` emergency bypass flag - Add unit and integration tests - Add documentation in `docs/proxy.md` ## Configuration Environment variables: ```bash export HTTPS_PROXY=http://proxy:8080 export NO_PROXY=localhost,*.internal.com ``` Or in `opencode.json`: ```json { "proxy": { "https": "http://proxy:8080", "no_proxy": ["localhost", "*.internal.com"] } } ``` ## Verification - All 822 existing tests pass - Tested manually behind corporate proxy (France Travail) - Verified API calls go through proxy - Verified `NO_PROXY` bypass works for internal hosts
yindo added the pull-request label 2026-02-16 18:18:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13582