Repository navigation
Description
What version of Codex CLI is running?
codex-cli 0.117.0
What subscription do you have?
Organization
Which model were you using?
No response
What platform is your computer?
Linux server
What terminal emulator and version are you using (if applicable)?
No response
What issue are you seeing?
Codex CLI fails on a Linux server behind an HTTP proxy, even though direct curl works from the same shell session.
I tested all of the following in the same Linux shell:
-
curlto the OpenAI Responses API works, including streaming:curl -N -v https://api.openai.com/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "gpt-5.2", "input": "say hello", "stream": true }'
-
Starting
codexin the same shell fails during conversation with:
Stream disconnected before completion: error sending request for url (https://api.openai.com/v1/responses) -
I also tried:
- launching
codexfrom the exact same shell ascurl - explicitly passing proxy-related env vars when starting
codex - upgrading Codex CLI to the latest version
The failure still happens.
- launching
-
After logging out, I tried ChatGPT device-code login on this headless Linux server:
codex login --device-authThat also fails, with:
error sending request for url (https://auth.openai.com/api/accounts/deviceauth/usercode)
So in this environment:
- direct
curltohttps://api.openai.com/v1/responsesworks - Codex CLI request path to
https://api.openai.com/v1/responsesfails - Codex CLI device-auth request path to
https://auth.openai.com/api/accounts/deviceauth/usercodealso fails
This makes it look like the CLI’s HTTP/proxy/TLS handling is behaving differently from curl in the same environment.
What steps can reproduce the bug?
-
Prepare a Linux server that accesses the internet through an HTTP proxy.
-
Export the proxy environment variables in the shell where Codex CLI will be launched, for example:
export https_proxy=http://<proxy-host>:<proxy-port>
export http_proxy=http://<proxy-host>:<proxy-port> -
Verify that direct OpenAI API access works with
curlfrom the same shell:
curl -N -v https://api.openai.com/v1/responses -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d '{"model":"gpt-5.2","input":"say hello","stream":true}' -
Launch Codex CLI from that same shell:
codex -
Send any prompt in Codex CLI.
-
Observe that the request fails with:
Stream disconnected before completion: error sending request for url (https://api.openai.com/v1/responses) -
Log out and try device-code authentication:
codex logout
codex login --device-auth -
Observe that device auth also fails with:
error sending request for url (https://auth.openai.com/api/accounts/deviceauth/usercode)
What is the expected behavior?
No response
Additional information
No response
Activity
github-actions commentedon Mar 28, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
etraut-openai commentedon Mar 28, 2026
This sounds specific to your proxy configuration. You'll need to investigate further and diagnose the problem.
github-yxb commentedon Mar 28, 2026
Thanks. I agree the proxy is part of the environment, but I don't think this has been narrowed down to "just a proxy misconfiguration" yet.
Here is why I opened the issue:
curltohttps://api.openai.com/v1/responsesworks from the same Linux servercodexfails from the same shell session, with the same proxy env varscodex logout,codex login --device-authalso fails onhttps://auth.openai.com/api/accounts/deviceauth/usercodegithub-yxb commentedon Mar 28, 2026
I have a useful update.
As a workaround, I asked another AI tool to generate a small local proxy service. It runs as an HTTP server on
127.0.0.1:9999, accepts Codex requests locally, and then forwards them to OpenAI through my existing proxy setup.After that, I updated
~/.codex/config.tomlto use the local service:With this configuration, Codex works.
To me, this strongly suggests the issue is not simply “my proxy is broken”. The same environment fails when Codex talks to OpenAI directly, but succeeds when Codex talks to a local HTTP service that forwards the request through the proxy.
That points to some difference in how Codex handles direct outbound proxy/TLS/networking compared with other clients.
This workaround took hours to figure out, so I do think this issue deserves investigation, even if the root cause is an interaction with certain proxy environments.
928234269 commentedon Apr 2, 2026
I also encountered the same problem. I looked into many issues, but it seems that the developers never regarded this as a problem. It's quite strange. Have they ever used Codex in the proxy scenario themselves?
iamryanchia commentedon Apr 11, 2026
Encounter the same problem
MichaelErmer commentedon Apr 23, 2026
PSA: The issue is with TLS, you need to have your proxy/gateway support TLS1.2 until codex (Mac ARM) is fixed to support TLS1.3
Haxel0rd commentedon Jul 15, 2026
There is clearly some issue with codex app about this,- in my case update to latest codex caused the same error, while minutes before everything was fine. I was not running traffic through any proxy and the issue also persists with reboot, while everything else works fine and as usual.
Haxel0rd commentedon Jul 16, 2026
Was able to get codex working again for me, in my case the DNS resolution in WSL instance was broken, you can confirm it with running this in your WSL machine:
If this says name or service not known and the following ping returns normal answer:
Then your issue is most likely in
Quickfix: set google DNS as nameserver. This should make codex work again and from that moment on you can tell him to find out why it happened in the first place. resolv.conf should look something like this then:
and curl to auth.openai.com should now work again.
== UPDATE ==
found the source of the problem, it seems to be an issue with stale HSN Firewall rules. I used the following commands, found under https://learn.microsoft.com/en-us/windows/wsl/troubleshooting under "Troubleshooting DNS in WSL" under point 4.:
(note this will remove firewall rules for port 53/udp, usually not a problem unless you have explicit custom setup there).
Then set DNS to local resolver and it my old setup before the quickfix (setting google dns), was working again as usual.
ZzzTSudio commentedon Sep 3, 2026
I encountered the same issue. On an ARM Linux machine like nvidia dgx spark, the login credentials are correct, but the conversation always remains in the connecting state, which is exactly the same as the abnormal situation described above.It seems that the codex cli and chatgpt app share a common login system, and this issue can be reproduced even with a proxy enabled.
ZzzTSudio commentedon Sep 3, 2026
The proxy service utilizes the open-source software Clash Verge, which functions perfectly on Windows systems and can be used with Codex.
ZXCYFR commentedon Oct 8, 2026
我在 Ubuntu 24.04 上也遇到了类似情况,用的是 Clash Verge。CLI 在系统代理下正常,桌面版却一直没输出,开 TUN 才能用。
我这边有效的办法是单独做一个启动脚本:给桌面程序传入代理环境变量,同时加上 Chromium 的代理参数。只开系统代理似乎没有让桌面里的所有网络请求都走代理。
配置大致如下,7897 换成自己的 Clash HTTP/mixed 端口:
要先完全退出旧的桌面进程,再用脚本启动,否则可能还是原来的进程在运行。我另外加了一个 ChatGPT Clash 菜单入口,保留原版入口,方便以后切回去。有内网 VPN 的话,把实际内网网段也加进代理例外。
这样关掉 TUN 后,本地桌面对话已经能用了。不过菜单冷启动的登录状态还需要观察,云端 durable 连接仍有超时。这个办法供“CLI 正常、桌面不正常”的情况参考,不一定适用于主帖里 CLI 也失败的问题。
qiansu0725 commentedon Oct 9, 2026
switch the proxy type from Socks5 to Socks5+Http just solve this