Support configuring outbound HTTP proxy via http_proxy in config.toml
What feature would you like to see?
# Support configuring outbound HTTP proxy via http_proxy in config.toml
🧭 Background & Motivation
Many enterprise and academic environments route outbound traffic through HTTP proxies (Zscaler, explicit/PAC proxies, on-prem egress).
Codex currently lacks first-class proxy support, leading to:
- Unpredictable network request failures in CI/CD and sandboxed setups
- Divergence between local runs (no proxy) and pipeline runs (behind proxy)
- Fragile, undocumented workarounds (manual
export HTTP_PROXY, wrapper scripts)
A prior PR (#4261) proposed adding proxy support via configuration, but was closed since the project isn’t generally accepting new features right now.
This issue tracks that enhancement for community discussion and roadmap consideration.
---
✅ Proposal
Introduce an optional http_proxy field in the Codex configuration that, when set, is forwarded to the process environment variable HTTP_PROXY before the HTTP client initializes.
Key elements
- Config:
http_proxyinconfig.tomland profiles - Startup: On process startup, if set, propagate
http_proxy→HTTP_PROXY - Docs: Add a
## http_proxysection indocs/config.mdwith examples - Tests: Unit test asserting that
http_proxyin config setsHTTP_PROXYat runtime
These elements mirror what was proposed in PR #4261, with ~60 new lines across:
codex-rs/core/src/config.rscodex-rs/core/src/config_profile.rsdocs/config.md
---
🔒 Security & Operational Notes
- Propagation occurs before worker threads spawn → race-free
- Proxy value should not be logged or echoed in errors (avoid secret leakage)
- In sandboxed environments, proxies remain ineffective by design — should be documented
---
🔁 Backward Compatibility
http_proxyis optional; if unset, behavior is unchanged- No breaking changes to public APIs or CLI behavior
---
🔄 Alternatives Considered
- Rely only on system env vars — brittle and inconsistent across CI vs local
- Per-request proxy control — overly granular for a first iteration
- PAC/auto-detection — platform-dependent, can be added later
---
🧪 Testing Strategy
- Unit: Validate that
http_proxyin config setsHTTP_PROXY - Integration: Verify outbound requests route through the configured proxy
- Regression: Ensure unchanged behavior when
http_proxyis absent
---
📝 Documentation Snippet
# ~/.config/codex/config.toml
http_proxy = "http://localhost:8080"
Include notes on precedence (Profile → Base Config → Defaults) and known sandbox limitations.
---
📣 Community Feedback Requested
- Does a global
HTTP_PROXYpropagation meet your needs, or do you require per-service granularity? - Should
NO_PROXYor authenticated proxies be supported in v1?
---
🏷️ Labels
enhancement config networking proxy
Additional information
_No response_
14 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
The following should be configurable:
i also want this, without this cannot use codex on corp PC
Me too. I think socks5 proxy is also an necessary.
You could write the HTTP proxy in
~/.codex/.env.Such as
I hope the proxy config can work in sandbox , if my code need proxy
Thanks for the replay.
It's very helpful.
I would have a try.
wyx @.***> 于2026年4月21日周二 10:41写道:
It works, thanks a lot.
<img width="1217" height="1144" alt="Image" src="https://github.com/user-attachments/assets/958f4e5f-ab7e-47f0-bac6-787fd82ceec2" />
Does codex read
.envfile on Windows?I doubt it's not set yet.
please fix this, we need it.
For Windows users trying to determine whether proxy environment variables are actually visible, and whether they conflict with Windows user proxy or WinHTTP settings, I maintain a small read-only diagnostic CLI called
proxy-path-doctor:It reports
HTTP_PROXY,HTTPS_PROXY,ALL_PROXY, andNO_PROXYalongside Windows user proxy and WinHTTP proxy state, with credentials redacted. It does not configure Codex or solve the missing first-class proxy setting, but it may help affected users produce a clearer environment report without guessing which proxy source is active. Please review output before sharing because proxy addresses may still be sensitive.A simple solution: https://github.com/icyblazek/codex-gui-proxy
support codex gui app
In case of macOS, it's also possible to run Codex GUI app like this:
The running instance should correctly use the proxy set in the env.
Maybe it does not work today at
Version 26.623.81905 • Released Jul 1, 2026.