装了 codex ,本地通过如下方法可以使用代理,然后使用 codex
export HTTP_PROXY="socks5://127.0.0.1:1080"
export HTTPS_PROXY="socks5://127.0.0.1:1080"
code &
我的使用场景是需要链接服务器,在服务端挂载这个代理呢?
![]() |
1
jayeli 10 天前
ssh 端口映射? ssh -N -R
|
2
faoisdjioga OP |
3
aarones 10 天前
试一下把这个代理环境变量加到/etc/profile 下面,改好再重新连接
|
4
faoisdjioga OP # 1. Create a global proxy agent file
mkdir -p ~/.vscode-server/extensions cat > ~/.vscode-server/extensions/proxy-agent.js <<'EOF' const { setGlobalDispatcher, ProxyAgent } = require('undici'); const proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY; if (proxy) { console.log('[VSCode Proxy] Using proxy:', proxy); setGlobalDispatcher(new ProxyAgent(proxy)); } EOF # 2. Export proxy and Node options globally echo 'export HTTP_PROXY="socks5://127.0.0.1:1080"' >> ~/.bashrc echo 'export HTTPS_PROXY="socks5://127.0.0.1:1080"' >> ~/.bashrc echo 'export NODE_OPTIONS="--require ~/.vscode-server/extensions/proxy-agent.js"' >> ~/.bashrc source ~/.bashrc 因为没有 root ,chatgpt 给了我一个方式成功了。chatgpt 的解释为 🧠 1. What the problem really was When you run VS Code Remote SSH, the “editor” part runs on your Mac, but the extensions (ChatGPT, Copilot, Supermaven, R, etc.) run on the remote Linux server inside a Node.js process called the extension host: VSCode (Mac) └── SSH tunnel └── vscode-server (Ubuntu) └── node --type=extensionHost └── openai.chatgpt-0.4.19-linux-x64 That Node process makes its own outbound HTTPS calls (to api.openai.com, etc.). By default, it doesn’t inherit your system or VS Code proxy because: VS Code starts that process with --useHostProxy=false (no host proxy forwarding) Node’s internal HTTP client ignores http.proxy from VS Code settings Therefore → all extension network traffic bypasses your proxy So the ChatGPT / CodeX extension couldn’t reach the Internet unless the server itself had open access. |
5
faoisdjioga OP 用他,注意是在 Remote-Server
{ "http.proxy": "http://127.0.0.1:1080", "http.proxyStrictSSL": false, "http.systemCertificates": false } |
6
NickLuan 7 天前
服务器是国内的吗,会被检测吗
|
7
faoisdjioga OP @NickLuan 国外。走的 trojan-go
|
8
faoisdjioga OP @NickLuan 刚刚我理解错了。服务器是在国内。 代理是在国外。
|
9
NickLuan 3 天前
@faoisdjioga #8 对的,国内的服务器,我担心的是被服务器的运营商检测到,比如阿里腾讯的,检测到你在服务器上挂代理会不会被封掉
|
10
faoisdjioga OP @NickLuan 服务器是公司内部的计算服务器,因此没有您说的这个问题。运营商的服务器没有用过,不太清楚
|