Support HTTP_PROXY & HTTPS_PROXY for millions of users who are behind fire walls in some regions and some organizations. #387

Open
opened 2026-02-16 17:26:31 -05:00 by yindo · 36 comments
Owner

Originally created by @henryleu on GitHub (Jun 29, 2025).

Originally assigned to: @rekram1-node on GitHub.

Support access LLM APIs with/without HTTP_PROXY & HTTPS_PROXY in these OSs:

in macos

export HTTP_PROXY=http://127.0.0.1:7897
export HTTPS_PROXY=http://127.0.0.1:7897

in linux

export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890

in windows

for cmd

set HTTP_PROXY=http://127.0.0.1:7897
set HTTPS_PROXY=http://127.0.0.1:7897

for powershell

$env:HTTP_PROXY = "http://127.0.0.1:7897"
$env:HTTPS_PROXY = "http://127.0.0.1:7897"

Originally created by @henryleu on GitHub (Jun 29, 2025). Originally assigned to: @rekram1-node on GitHub. Support access LLM APIs with/without HTTP_PROXY & HTTPS_PROXY in these OSs: # in macos export HTTP_PROXY=http://127.0.0.1:7897 export HTTPS_PROXY=http://127.0.0.1:7897 # in linux export HTTP_PROXY=http://127.0.0.1:7890 export HTTPS_PROXY=http://127.0.0.1:7890 # in windows # for cmd set HTTP_PROXY=http://127.0.0.1:7897 set HTTPS_PROXY=http://127.0.0.1:7897 # for powershell $env:HTTP_PROXY = "http://127.0.0.1:7897" $env:HTTPS_PROXY = "http://127.0.0.1:7897"
Author
Owner

@thdxr commented on GitHub (Jun 30, 2025):

hm this doesn't already work? i'll check - it should

@thdxr commented on GitHub (Jun 30, 2025): hm this doesn't already work? i'll check - it should
Author
Owner

@aspiers commented on GitHub (Jun 30, 2025):

I could not get it working with a SOCKS5 proxy via environment variables (had to resort to using proxychains), but maybe it works with normal HTTP / HTTPS proxies.

@aspiers commented on GitHub (Jun 30, 2025): I could not get it working with a SOCKS5 proxy via environment variables (had to resort to using proxychains), but maybe it works with normal HTTP / HTTPS proxies.
Author
Owner

@zerounix commented on GitHub (Jul 10, 2025):

same on my side. exporting https_proxy, http_proxy does not work.
error is Unable to connect. Is the computer able to access the url?

i double check with our proxy admin, opencode is not hitting the proxy.

@zerounix commented on GitHub (Jul 10, 2025): same on my side. exporting https_proxy, http_proxy does not work. error is Unable to connect. Is the computer able to access the url? i double check with our proxy admin, opencode is not hitting the proxy.
Author
Owner

@zerounix commented on GitHub (Jul 10, 2025):

works for me now. was using windows executable in wsl, reinstalled via node. now i can connect.

@zerounix commented on GitHub (Jul 10, 2025): works for me now. was using windows executable in wsl, reinstalled via node. now i can connect.
Author
Owner

@Soupra-D commented on GitHub (Jul 17, 2025):

@zerounix can you explain your setup in WSL ?
Your http_proxy and https_proxy values in windows and wsl are the same or differ ?

@Soupra-D commented on GitHub (Jul 17, 2025): @zerounix can you explain your setup in WSL ? Your http_proxy and https_proxy values in windows and wsl are the same or differ ?
Author
Owner

@toomanyopenfiles commented on GitHub (Jul 25, 2025):

I noticed that GEMINI-CLI has added a "--proxy" parameter in the startup arguments to ensure that all network communication layers use the specified proxy:

$ gemini --help
--proxy Proxy for gemini client, like schema://user:password@host:port

You can refer to the following PR:
https://github.com/google-gemini/gemini-cli/pull/2526

May I ask @thdxr if a similar implementation could be considered in opencode? This would maximize the correctness of the proxy network.

@toomanyopenfiles commented on GitHub (Jul 25, 2025): I noticed that GEMINI-CLI has added a "--proxy" parameter in the startup arguments to ensure that all network communication layers use the specified proxy: $ gemini --help --proxy Proxy for gemini client, like schema://user:password@host:port You can refer to the following PR: https://github.com/google-gemini/gemini-cli/pull/2526 May I ask @thdxr if a similar implementation could be considered in opencode? This would maximize the correctness of the proxy network.
Author
Owner

@dhandhalyabhavik commented on GitHub (Aug 24, 2025):

The temporary hack for me which worked was using it inside docker docker run -e <your proxy> opencode-ai:latest

@dhandhalyabhavik commented on GitHub (Aug 24, 2025): The temporary hack for me which worked was using it inside docker `docker run -e <your proxy> opencode-ai:latest`
Author
Owner

@Phosphate5429 commented on GitHub (Nov 29, 2025):

--proxy Proxy for gemini client, like schema://user:password@host:port

need !

@Phosphate5429 commented on GitHub (Nov 29, 2025): > --proxy Proxy for gemini client, like schema://user:password@host:port need !
Author
Owner

@olk commented on GitHub (Dec 1, 2025):

same problem here with v1.0.119

@olk commented on GitHub (Dec 1, 2025): same problem here with v1.0.119
Author
Owner

@Zhaoyilunnn commented on GitHub (Dec 1, 2025):

This is definitely a deal breaker for me to choose between opencode and gemini-cli

@Zhaoyilunnn commented on GitHub (Dec 1, 2025): This is definitely a deal breaker for me to choose between opencode and gemini-cli
Author
Owner

@antoinepourriot commented on GitHub (Dec 4, 2025):

+1

@antoinepourriot commented on GitHub (Dec 4, 2025): +1
Author
Owner

@7jrxt42BxFZo4iAnN4CX commented on GitHub (Dec 6, 2025):

+2

@7jrxt42BxFZo4iAnN4CX commented on GitHub (Dec 6, 2025): +2
Author
Owner

@rekram1-node commented on GitHub (Dec 8, 2025):

set this and it should work:
NO_PROXY=localhost,127.0.0.1

@rekram1-node commented on GitHub (Dec 8, 2025): set this and it should work: `NO_PROXY=localhost,127.0.0.1 `
Author
Owner

@olk commented on GitHub (Dec 8, 2025):

set this and it should work: NO_PROXY=localhost,127.0.0.1

unfortunately - doesn't work:

export NO_PROXY=localhost,127.0.0.1
opencode
^[[I^[[I^[[I^[[I<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta type="copyright" content="Copyright (C) 1996-2021 The Squid Software Foundation and contributors">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--
 /*
 * Copyright (C) 1996-2024 The Squid Software Foundation and contributors
 *
 * Squid software is distributed under GPLv2+ license and includes
 * contributions from numerous individuals and organizations.
 * Please see the COPYING and CONTRIBUTORS files for details.
 */

/*
 Stylesheet for Squid Error pages
 Adapted from design by Free CSS Templates
 http://www.freecsstemplates.org
 Released for free under a Creative Commons Attribution 2.5 License
*/

/* Page basics */
* {
	font-family: verdana, sans-serif;
}

html body {
	margin: 0;
	padding: 0;
	background: #efefef;
	font-size: 12px;
	color: #1e1e1e;
}

/* Page displayed title area */
#titles {
	margin-left: 15px;
	padding: 10px;
	padding-left: 100px;
	background: url('/squid-internal-static/icons/SN.png') no-repeat left;
}

/* initial title */
#titles h1 {
	color: #000000;
}
#titles h2 {
	color: #000000;
}

/* special event: FTP success page titles */
#titles ftpsuccess {
	background-color:#00ff00;
	width:100%;
}

/* Page displayed body content area */
#content {
	padding: 10px;
	background: #ffffff;
}

/* General text */
p {
}

/* error brief description */
#error p {
}

/* some data which may have caused the problem */
#data {
}

/* the error message received from the system or other software */
#sysmsg {
}

pre {
}

/* special event: FTP directory listing */
#dirmsg {
    font-family: courier, monospace;
    color: black;
    font-size: 10pt;
}
#dirlisting {
    margin-left: 2%;
    margin-right: 2%;
}
#dirlisting tr.entry td.icon,td.filename,td.size,td.date {
    border-bottom: groove;
}
#dirlisting td.size {
    width: 50px;
    text-align: right;
    padding-right: 5px;
}

/* horizontal lines */
hr {
	margin: 0;
}

/* page displayed footer area */
#footer {
	font-size: 9px;
	padding-left: 10px;
}


body
:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }
:lang(he) { direction: rtl; }
 --></style>
</head><body id=ERR_ACCESS_DENIED>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>

<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="http://127.0.0.1:35569/agent">http://127.0.0.1:35569/agent</a></p>

<blockquote id="error">
<p><b>Access Denied.</b></p>
</blockquote>

<p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>

<p>Your cache administrator is <a href="mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_ACCESS_DENIED&amp;body=CacheHost%3A%20pxweb1%0D%0AErrPage%3A%20ERR_ACCESS_DENIED%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Mon,%2008%20Dec%202025%2007%3A40%3A14%20GMT%0D%0A%0D%0AClientIP%3A%20172.18.162.153%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2Fagent%20HTTP%2F1.1%0AProxy-Connection%3A%20Keep-Alive%0D%0AConnection%3A%20keep-alive%0D%0AUser-Agent%3A%20opencode%2F1.0.119%0D%0AAccept%3A%20*%2F*%0D%0AHost%3A%20127.0.0.1%3A35569%0D%0AAccept-Encoding%3A%20gzip,%20deflate,%20br,%20zstd%0D%0A%0D%0A%0D%0A">webmaster</a>.</p>
<br>
</div>

<hr>
<div id="footer">
<p>Generated Mon, 08 Dec 2025 07:40:14 GMT by pxweb1 (squid/6.13)</p>
<!-- ERR_ACCESS_DENIED -->
</div>
</body></html>
@olk commented on GitHub (Dec 8, 2025): > set this and it should work: `NO_PROXY=localhost,127.0.0.1 ` unfortunately - doesn't work: ``` export NO_PROXY=localhost,127.0.0.1 opencode ^[[I^[[I^[[I^[[I<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta type="copyright" content="Copyright (C) 1996-2021 The Squid Software Foundation and contributors"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>ERROR: The requested URL could not be retrieved</title> <style type="text/css"><!-- /* * Copyright (C) 1996-2024 The Squid Software Foundation and contributors * * Squid software is distributed under GPLv2+ license and includes * contributions from numerous individuals and organizations. * Please see the COPYING and CONTRIBUTORS files for details. */ /* Stylesheet for Squid Error pages Adapted from design by Free CSS Templates http://www.freecsstemplates.org Released for free under a Creative Commons Attribution 2.5 License */ /* Page basics */ * { font-family: verdana, sans-serif; } html body { margin: 0; padding: 0; background: #efefef; font-size: 12px; color: #1e1e1e; } /* Page displayed title area */ #titles { margin-left: 15px; padding: 10px; padding-left: 100px; background: url('/squid-internal-static/icons/SN.png') no-repeat left; } /* initial title */ #titles h1 { color: #000000; } #titles h2 { color: #000000; } /* special event: FTP success page titles */ #titles ftpsuccess { background-color:#00ff00; width:100%; } /* Page displayed body content area */ #content { padding: 10px; background: #ffffff; } /* General text */ p { } /* error brief description */ #error p { } /* some data which may have caused the problem */ #data { } /* the error message received from the system or other software */ #sysmsg { } pre { } /* special event: FTP directory listing */ #dirmsg { font-family: courier, monospace; color: black; font-size: 10pt; } #dirlisting { margin-left: 2%; margin-right: 2%; } #dirlisting tr.entry td.icon,td.filename,td.size,td.date { border-bottom: groove; } #dirlisting td.size { width: 50px; text-align: right; padding-right: 5px; } /* horizontal lines */ hr { margin: 0; } /* page displayed footer area */ #footer { font-size: 9px; padding-left: 10px; } body :lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; } :lang(he) { direction: rtl; } --></style> </head><body id=ERR_ACCESS_DENIED> <div id="titles"> <h1>ERROR</h1> <h2>The requested URL could not be retrieved</h2> </div> <hr> <div id="content"> <p>The following error was encountered while trying to retrieve the URL: <a href="http://127.0.0.1:35569/agent">http://127.0.0.1:35569/agent</a></p> <blockquote id="error"> <p><b>Access Denied.</b></p> </blockquote> <p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p> <p>Your cache administrator is <a href="mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_ACCESS_DENIED&amp;body=CacheHost%3A%20pxweb1%0D%0AErrPage%3A%20ERR_ACCESS_DENIED%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Mon,%2008%20Dec%202025%2007%3A40%3A14%20GMT%0D%0A%0D%0AClientIP%3A%20172.18.162.153%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2Fagent%20HTTP%2F1.1%0AProxy-Connection%3A%20Keep-Alive%0D%0AConnection%3A%20keep-alive%0D%0AUser-Agent%3A%20opencode%2F1.0.119%0D%0AAccept%3A%20*%2F*%0D%0AHost%3A%20127.0.0.1%3A35569%0D%0AAccept-Encoding%3A%20gzip,%20deflate,%20br,%20zstd%0D%0A%0D%0A%0D%0A">webmaster</a>.</p> <br> </div> <hr> <div id="footer"> <p>Generated Mon, 08 Dec 2025 07:40:14 GMT by pxweb1 (squid/6.13)</p> <!-- ERR_ACCESS_DENIED --> </div> </body></html> ```
Author
Owner

@rekram1-node commented on GitHub (Dec 8, 2025):

hm well it may depend on ur proxy i set up one and that got it working ill check it oit tbo

@rekram1-node commented on GitHub (Dec 8, 2025): hm well it may depend on ur proxy i set up one and that got it working ill check it oit tbo
Author
Owner

@7jrxt42BxFZo4iAnN4CX commented on GitHub (Dec 8, 2025):

set this and it should work: NO_PROXY=localhost,127.0.0.1

Archlinux, HTTP proxy:

Forbidden: {
  "error": {
    "type": "forbidden",
    "message": "Request not allowed"
  }
}
@7jrxt42BxFZo4iAnN4CX commented on GitHub (Dec 8, 2025): > set this and it should work: `NO_PROXY=localhost,127.0.0.1 ` **Archlinux, HTTP proxy:** ``` Forbidden: { "error": { "type": "forbidden", "message": "Request not allowed" } } ```
Author
Owner

@olk commented on GitHub (Dec 8, 2025):

hm well it may depend on ur proxy i set up one and that got it working ill check it oit tbo

The proxy runs on another host (setup by the company) - on my system no proxy is running. As the error output shows, http://127.0.0.1:35569/agent was blocked.
Might this be a problem of a framework opencode is using?

@olk commented on GitHub (Dec 8, 2025): > hm well it may depend on ur proxy i set up one and that got it working ill check it oit tbo The proxy runs on another host (setup by the company) - on my system no proxy is running. As the error output shows, http://127.0.0.1:35569/agent was blocked. Might this be a problem of a framework opencode is using?
Author
Owner

@rekram1-node commented on GitHub (Dec 12, 2025):

You may also need:

If your enterprise environment uses custom CAs for HTTPS connections (whether through a proxy or direct API access), configure OpenCode Code to trust them:
export NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem

@rekram1-node commented on GitHub (Dec 12, 2025): You may also need: If your enterprise environment uses custom CAs for HTTPS connections (whether through a proxy or direct API access), configure OpenCode Code to trust them: export NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem
Author
Owner

@acheong08 commented on GitHub (Dec 16, 2025):

My issue seems to be related by slightly different.

acheong@fishy ~/d/platform (develop)> echo $all_proxy
socks5://127.0.0.1:1090
acheong@fishy ~/d/platform (develop)> echo $HTTP_PROXY 
socks5://127.0.0.1:1090
acheong@fishy ~/d/platform (develop)> echo $HTTPS_PROXY 
socks5://127.0.0.1:1090
acheong@fishy ~/d/platform (develop)> opencode
Error: UnsupportedProxyProtocol fetching "http://127.0.0.1:42245/config/providers". For more information, pass `verbose: true` in the second argument to fetch()

Setting export NO_PROXY=localhost,127.0.0.1 lets me get to the TUI screen but sending a request still throws

Error: UnsupportedProxyProtocol fetching "https://api.github.com/copilot_internal/v2/token". For more            
  ┃  information, pass `verbose: true` in the second argument to fetch()

No CA sniffing or whatnot. Standard socks proxy over ssh

@acheong08 commented on GitHub (Dec 16, 2025): My issue seems to be related by slightly different. ``` acheong@fishy ~/d/platform (develop)> echo $all_proxy socks5://127.0.0.1:1090 acheong@fishy ~/d/platform (develop)> echo $HTTP_PROXY socks5://127.0.0.1:1090 acheong@fishy ~/d/platform (develop)> echo $HTTPS_PROXY socks5://127.0.0.1:1090 acheong@fishy ~/d/platform (develop)> opencode Error: UnsupportedProxyProtocol fetching "http://127.0.0.1:42245/config/providers". For more information, pass `verbose: true` in the second argument to fetch() ``` Setting `export NO_PROXY=localhost,127.0.0.1` lets me get to the TUI screen but sending a request still throws ``` Error: UnsupportedProxyProtocol fetching "https://api.github.com/copilot_internal/v2/token". For more ┃ information, pass `verbose: true` in the second argument to fetch() ``` No CA sniffing or whatnot. Standard socks proxy over ssh
Author
Owner

@rekram1-node commented on GitHub (Dec 16, 2025):

hm interesting ill take a look

@rekram1-node commented on GitHub (Dec 16, 2025): hm interesting ill take a look
Author
Owner

@olk commented on GitHub (Dec 16, 2025):

You may also need:

If your enterprise environment uses custom CAs for HTTPS connections (whether through a proxy or direct API access), configure OpenCode Code to trust them: export NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem

sorry, error still persists. :^(

@olk commented on GitHub (Dec 16, 2025): > You may also need: > > If your enterprise environment uses custom CAs for HTTPS connections (whether through a proxy or direct API access), configure OpenCode Code to trust them: export NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem sorry, error still persists. :^(
Author
Owner

@rekram1-node commented on GitHub (Dec 16, 2025):

@olk your system blocks requests to a server running on ur own machine? Did u set NO_PROXY?

@rekram1-node commented on GitHub (Dec 16, 2025): @olk your system blocks requests to a server running on ur own machine? Did u set NO_PROXY?
Author
Owner

@olk commented on GitHub (Dec 16, 2025):

@olk your system blocks requests to a server running on ur own machine? Did u set NO_PROXY?

no, the server is running in the intranet at ai.abc.xyz.
NO_PROXY=127.0.0.1,10.0.0.0/8,localhost,.abc.xyz

@olk commented on GitHub (Dec 16, 2025): > [@olk](https://github.com/olk) your system blocks requests to a server running on ur own machine? Did u set NO_PROXY? no, the server is running in the intranet at ai.abc.xyz. NO_PROXY=127.0.0.1,10.0.0.0/8,localhost,.abc.xyz
Author
Owner

@acheong08 commented on GitHub (Dec 16, 2025):

I could not get it working with a SOCKS5 proxy via environment variables (had to resort to using proxychains), but maybe it works with normal HTTP / HTTPS proxies.

How did you get it working with proxychains? It doesn't error but simply times out for me

@acheong08 commented on GitHub (Dec 16, 2025): > I could not get it working with a SOCKS5 proxy via environment variables (had to resort to using proxychains), but maybe it works with normal HTTP / HTTPS proxies. How did you get it working with proxychains? It doesn't error but simply times out for me
Author
Owner

@acheong08 commented on GitHub (Dec 16, 2025):

By the way, the error comes from bun:

acheong@fishy ~> node -e 'fetch("https://api.github.com").then(r=>console.log("ok", r.status)).catch(e=>console.error(e.message))'
ok 200
acheong@fishy ~> bun -e 'fetch("https://api.github.com").then(r=>console.log("ok", r.status)).catch(e=>console.error(e
.message))'
UnsupportedProxyProtocol fetching "https://api.github.com/". For more information, pass `verbose: true` in the second argument to fetch()

PR is here: https://github.com/oven-sh/bun/pull/23220

I find it mildly concerning how much Bun is using Claude but eh... as long as it works.

Edit: Opencode bundles bun, just like Claude code. Using npm i -g does not remove the bun dependency

@acheong08 commented on GitHub (Dec 16, 2025): By the way, the error comes from bun: ``` acheong@fishy ~> node -e 'fetch("https://api.github.com").then(r=>console.log("ok", r.status)).catch(e=>console.error(e.message))' ok 200 acheong@fishy ~> bun -e 'fetch("https://api.github.com").then(r=>console.log("ok", r.status)).catch(e=>console.error(e .message))' UnsupportedProxyProtocol fetching "https://api.github.com/". For more information, pass `verbose: true` in the second argument to fetch() ``` PR is here: https://github.com/oven-sh/bun/pull/23220 I find it mildly concerning how much Bun is using Claude but eh... as long as it works. Edit: Opencode bundles bun, just like Claude code. Using `npm i -g` does not remove the bun dependency
Author
Owner

@ZeroCool2u commented on GitHub (Dec 17, 2025):

It would be great if a note could be added to the OpenCode docs that it does not support environments with corporate proxies right now and to keep an eye on this issue for when it'll be fixed. Would probably save a lot of people from wasting time trying to get this working and getting frustrated with OpenCode itself.

@ZeroCool2u commented on GitHub (Dec 17, 2025): It would be great if a note could be added to the OpenCode docs that it does not support environments with corporate proxies right now and to keep an eye on this issue for when it'll be fixed. Would probably save a lot of people from wasting time trying to get this working and getting frustrated with OpenCode itself.
Author
Owner

@id957659 commented on GitHub (Dec 17, 2025):

@olk @rekram1-node

Had same problem with corporate Squid proxy running elsewhere blocking requests to http://127.0.0.1:xxx/yyy.

export NO_PROXY=localhost,127.0.0.1

didn't fix it, but

export no_proxy=localhost,127.0.0.1

did.

Seems like opencode respects only the lowercase version of the ENV variable.

@id957659 commented on GitHub (Dec 17, 2025): @olk @rekram1-node Had same problem with corporate Squid proxy running elsewhere blocking requests to `http://127.0.0.1:xxx/yyy`. ``` export NO_PROXY=localhost,127.0.0.1 ``` didn't fix it, but ``` export no_proxy=localhost,127.0.0.1 ``` did. Seems like opencode respects only the lowercase version of the ENV variable.
Author
Owner

@rekram1-node commented on GitHub (Dec 17, 2025):

hm we don’t do special handling for either I think bun respects both but idk why the capitalized one didnt work for you

@rekram1-node commented on GitHub (Dec 17, 2025): hm we don’t do special handling for either I think bun respects both but idk why the capitalized one didnt work for you
Author
Owner

@olk commented on GitHub (Dec 17, 2025):

I was able to get opencode running.
I created a docker image (using Ubuntu as base; passing the HTTP_PROXY/HTTPS_PROXY/NO_PROXY env variables).
I don't know why it fails on Arch Linux with Proxy (company) and works at home (using Arch Linux too) without proxy.

@olk commented on GitHub (Dec 17, 2025): I was able to get opencode running. I created a docker image (using Ubuntu as base; passing the HTTP_PROXY/HTTPS_PROXY/NO_PROXY env variables). I don't know why it fails on Arch Linux with Proxy (company) and works at home (using Arch Linux too) without proxy.
Author
Owner

@apuppy commented on GitHub (Dec 23, 2025):

Seems it works now: Network | OpenCode

@apuppy commented on GitHub (Dec 23, 2025): Seems it works now: [Network | OpenCode](https://opencode.ai/docs/network/)
Author
Owner

@Zhaoyilunnn commented on GitHub (Dec 23, 2025):

Seems it works now: Network | OpenCode

Just tested, it's working now. Seems that only http/https are supported. Socks5 is not.

@Zhaoyilunnn commented on GitHub (Dec 23, 2025): > Seems it works now: [Network | OpenCode](https://opencode.ai/docs/network/) Just tested, it's working now. Seems that only http/https are supported. Socks5 is not.
Author
Owner

@rekram1-node commented on GitHub (Dec 23, 2025):

Bun is adding socks5 support soon, claude code has the same issue (cause they use bun too)

@rekram1-node commented on GitHub (Dec 23, 2025): Bun is adding socks5 support soon, claude code has the same issue (cause they use bun too)
Author
Owner

@Yegorov commented on GitHub (Jan 10, 2026):

One possible solution is to create an HTTPS proxy over SOCKS5 using go-http-proxy-to-socks:

  1. Generate self signed cert
openssl req -x509 -newkey rsa:2048 \
  -keyout key.pem \
  -out cert.pem \
  -sha256 \
  -days 365 \
  -nodes \
  -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=127.0.0.1" \
  -addext "subjectAltName=IP:127.0.0.1"
  1. Run in two different consoles (1090 - SOCKS5 port, 1110 - HTTP, 1111 - HTTPS)
./gohpts-v1.10.6-linux-amd64 -s :1090 -l :1110
./gohpts-v1.10.6-linux-amd64 -s :1090 -l :1111 -c cert.pem -k key.pem
  1. And run opencode with predefined envs var (or paste this envs to console)
export NODE_EXTRA_CA_CERTS=/fullpath/to/cert.pem
export HTTP_PROXY=http://127.0.0.1:1110
export HTTPS_PROXY=https://127.0.0.1:1111
export NO_PROXY=localhost,127.0.0.1

opencode
@Yegorov commented on GitHub (Jan 10, 2026): One possible solution is to create an HTTPS proxy over SOCKS5 using [go-http-proxy-to-socks](https://github.com/shadowy-pycoder/go-http-proxy-to-socks): 1) Generate self signed cert ``` openssl req -x509 -newkey rsa:2048 \ -keyout key.pem \ -out cert.pem \ -sha256 \ -days 365 \ -nodes \ -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=127.0.0.1" \ -addext "subjectAltName=IP:127.0.0.1" ``` 2) Run in two different consoles (1090 - SOCKS5 port, 1110 - HTTP, 1111 - HTTPS) ``` ./gohpts-v1.10.6-linux-amd64 -s :1090 -l :1110 ./gohpts-v1.10.6-linux-amd64 -s :1090 -l :1111 -c cert.pem -k key.pem ``` 3) And run opencode with predefined envs var (or paste this envs to console) ``` export NODE_EXTRA_CA_CERTS=/fullpath/to/cert.pem export HTTP_PROXY=http://127.0.0.1:1110 export HTTPS_PROXY=https://127.0.0.1:1111 export NO_PROXY=localhost,127.0.0.1 opencode ```
Author
Owner

@alvarovm commented on GitHub (Jan 14, 2026):

@Yegorov fantastic suggestion. Thank you

I wish one could simply do:
export HTTP_PROXY=socks5://127.0.0.1:1090
export HTTPS_PROXY=socks5h://127.0.0.1:1090

@alvarovm commented on GitHub (Jan 14, 2026): @Yegorov fantastic suggestion. Thank you I wish one could simply do: export HTTP_PROXY=socks5://127.0.0.1:1090 export HTTPS_PROXY=socks5h://127.0.0.1:1090
Author
Owner

@Thesam1798 commented on GitHub (Jan 27, 2026):

Fix available in PR #10856

PR #10856 implements comprehensive HTTP/HTTPS proxy support for opencode.

What's implemented:

  • HTTP_PROXY / http_proxy environment variables
  • HTTPS_PROXY / https_proxy environment variables
  • NO_PROXY / no_proxy with pattern matching (wildcards, suffixes, exact match)
  • Config file support via opencode.json:
{
  "proxy": {
    "http": "http://proxy:8080",
    "https": "http://proxy:8080",
    "no_proxy": ["localhost", "127.0.0.1", "*.internal.com"]
  }
}
  • TLS configuration for corporate proxies with custom CAs:
{
  "proxy": {
    "https": "http://proxy:8080",
    "tls": {
      "ca": "/path/to/corporate-ca.pem"
    }
  }
}
  • OPENCODE_DISABLE_PROXY emergency bypass flag

What's NOT supported (Bun limitation):

  • SOCKS5 proxies - Bun doesn't support them yet. Workaround: use a SOCKS-to-HTTP proxy bridge like go-http-proxy-to-socks

Real-world testing:
I'm using this fix daily behind a corporate proxy - all providers work, version checks work, ripgrep downloads work. No configuration needed beyond standard HTTPS_PROXY environment variable.

@Thesam1798 commented on GitHub (Jan 27, 2026): ## Fix available in PR #10856 PR #10856 implements comprehensive HTTP/HTTPS proxy support for opencode. **What's implemented:** - ✅ `HTTP_PROXY` / `http_proxy` environment variables - ✅ `HTTPS_PROXY` / `https_proxy` environment variables - ✅ `NO_PROXY` / `no_proxy` with pattern matching (wildcards, suffixes, exact match) - ✅ Config file support via `opencode.json`: ```json { "proxy": { "http": "http://proxy:8080", "https": "http://proxy:8080", "no_proxy": ["localhost", "127.0.0.1", "*.internal.com"] } } ``` - ✅ TLS configuration for corporate proxies with custom CAs: ```json { "proxy": { "https": "http://proxy:8080", "tls": { "ca": "/path/to/corporate-ca.pem" } } } ``` - ✅ `OPENCODE_DISABLE_PROXY` emergency bypass flag **What's NOT supported (Bun limitation):** - ❌ SOCKS5 proxies - Bun doesn't support them yet. Workaround: use a SOCKS-to-HTTP proxy bridge like [go-http-proxy-to-socks](https://github.com/shadowy-pycoder/go-http-proxy-to-socks) **Real-world testing:** I'm using this fix daily behind a corporate proxy - all providers work, version checks work, ripgrep downloads work. No configuration needed beyond standard `HTTPS_PROXY` environment variable.
Author
Owner

@winston-wen commented on GitHub (Feb 3, 2026):

I have noticed a strange phenomenon, and I still haven't figured out the cause.

Since I am in mainland China, I need to set http_proxy, https_proxy, and no_proxy to avoid network issues. After setting them:

  • When I run the opencode command, I encounter certificate problems regardless of whether NODE_TLS_REJECT_UNAUTHORIZED=0 is set.
  • However, when I run the absolute path of opencode (which is given by which opencode), I do not encounter any certificate issues, regardless of whether NODE_TLS_REJECT_UNAUTHORIZED=0 is set.
@winston-wen commented on GitHub (Feb 3, 2026): I have noticed a strange phenomenon, and I still haven't figured out the cause. Since I am in mainland China, I need to set `http_proxy`, `https_proxy`, and `no_proxy` to avoid network issues. After setting them: - When I run the `opencode` command, I encounter certificate problems regardless of whether `NODE_TLS_REJECT_UNAUTHORIZED=0` is set. - However, when I run the absolute path of opencode (which is given by `which opencode`), I do not encounter any certificate issues, regardless of whether `NODE_TLS_REJECT_UNAUTHORIZED=0` is set.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#387