GeezerVison is showing github.com — Browser tool does not respect the remote server's proxy settings when Desktop connects to a remote server · Issue #50476 · anomalyco/opencode
Browser tool does not respect the remote server's proxy settings when Desktop connects to a remote server #50476DescriptionDescription
When OpenCode Desktop (Windows GUI) is connected to a remote opencode serve server, all browser traffic egresses from the server through the browser tunnel. That tunnel is the one server-side outbound path that ignores the server's proxy configuration.
On a server that needs an outbound proxy (HTTPS_PROXY/HTTP_PROXY set as documented), everything else works: LLM requests and webfetch to the same host succeed and show up in the proxy's logs. The browser tunnel, however, is a plain TCP socket (packages/plugin-browser/src/tunnel.ts → createConnection({ host, port })) which never reads proxy settings — it always dials the target directly.
Result: any navigation to a host that is only reachable through the proxy fails. Chromium reports ERR_TUNNEL_CONNECTION_FAILED (-111); the Desktop UI only shows "The site failed to load through the connected server" after ~10s (the tunnel's own timeout), with the real error swallowed.
This mode has no client-side workaround: with GUI + remote server the client never dials out (Chromium → local /proxy → RPC tunnel.open → server), so only the server's proxy config can matter — and this is the single server-side path that ignores it.
Expected: tunnel egress should honor the server's proxy settings the same way LLM calls and webfetch do (e.g. by doing an HTTP CONNECT hop through the configured proxy) instead of always connecting directly.
Plugins
None — built-in browser tool only
OpenCode version
v2.0.12
Steps to reproduce
- On the server: set
HTTPS_PROXY/HTTP_PROXY to a proxy that can reach the target, and make the server unable to reach it directly.
- In a session on that server,
webfetch a URL on the target host → succeeds, and the request appears in the proxy's logs.
- On Windows, launch OpenCode Desktop and connect to that server.
browser.tabs.open the same URL → navigation fails ~10 seconds later; the tunnel never contacts the proxy (it connects straight to the target).
Screenshot and/or share link
Chromium: net::ERR_TUNNEL_CONNECTION_FAILED (-111)
Desktop error: browser.tabs.open failed. The site failed to load through the connected server.
Operating System
Windows 11 (Desktop GUI); server: Linux (Ubuntu / WSL2)
Terminal
OpenCode Desktop (Windows GUI) Activitydineshdh commented on Oct 14, 2026 I would like to contribute a fix for this. Corporate networks also need desktop previews to work when outbound access requires a proxy.
Would a focused PR adding upstream proxy support to the server-side browser tunnel be welcome? I propose starting with HTTP_PROXY/HTTPS_PROXY and NO_PROXY, preserving server-side routing, with integration tests for proxied connections, bypass rules, and proxy failures. I noticed #55528 changes the same transport; should this build on that work or target current dev?
For local Desktop usage, the broader requirement is to pick up OS proxy settings, including PAC, with explicit overrides where needed. That needs a separate design decision from server environment-variable support. Is that scope something you would support as a follow-up? mblanquer commented on Oct 27, 2026 I can reproduce the same browser-pane failure with a local Windows Desktop + local OpenCode service setup, not only when Desktop is connected to a remote server: #59722.
In my environment, Internet access requires the Windows corporate PAC/system proxy. System tools can reach public HTTPS URLs through the PAC, and internal sites load correctly in the OpenCode browser pane, but public Internet URLs fail in the OpenCode browser pane with ERR_TUNNEL_CONNECTION_FAILED (-111).
Maybe HTTP_PROXY / HTTPS_PROXY support will also fix my context, but the solution may need to include Windows system proxy/PAC support in the browser tunnel proxy work. opencodejr commented on Oct 28, 2026 Thanks for the detailed report. I can confirm this on v2.0.12, and it still happens on the latest dev (fa1260d6).
I couldn't run Desktop here, so I tested the server-side tunnel code directly. The script below starts a target that can only be reached through a local logging HTTP/CONNECT proxy and sets HTTP_PROXY and HTTPS_PROXY to that proxy.
- A normal fetch to the target goes through the proxy and succeeds.
- Opening a browser tunnel to the same host and port connects directly and fails (
getaddrinfo ENOTFOUND target.internal). The proxy is never contacted.
This matches what you describe: packages/plugin-browser/src/tunnel.ts dials with a plain createConnection and doesn't look at the proxy environment variables. I haven't checked the Desktop side of the report (the generic error that hides the real cause) here.
Reproduction script (tunnel-proxy.ts)
// Reproduces #50476: the browser tunnel (BrowserTunnel.open, used by the
// `tunnel.open` RPC when Desktop attaches to a remote server) ignores
// HTTPS_PROXY/HTTP_PROXY and always dials the target directly.
//
// Run: REPO=/workspace/repo bun /workspace/repro/tunnel-proxy.ts
import http from "node:http"
import net from "node:net"
import { Effect } from "effect"
const REPO = process.env.REPO ?? "/workspace/repo"
const { BrowserTunnel } = await import(`${REPO}/packages/plugin-browser/src/tunnel.ts`)
// Target: only reachable as "target.internal" through the proxy (the name does not resolve directly).
const target = http.createServer((_, res) => res.end("hello from target\n")).listen(18081, "127.0.0.1")
// Logging HTTP proxy that knows how to reach target.internal.
const log: string[] = []
const resolve = (host: string) => (host === "target.internal" ? "127.0.0.1" : host)
const proxy = http.createServer((req, res) => {
log.push(`HTTP ${req.method} ${req.url}`)
const u = new URL(req.url!)
const up = http.request({ host: resolve(u.hostname), port: u.port, path: u.pathname, method: req.method }, (r) => {
res.writeHead(r.statusCode!, r.headers)
r.pipe(res)
})
req.pipe(up)
})
proxy.on("connect", (req, sock) => {
log.push(`CONNECT ${req.url}`)
const [h, p] = req.url!.split(":")
const up = net.connect(Number(p), resolve(h), () => {
sock.write("HTTP/1.1 200 Connection Established\r\n\r\n")
up.pipe(sock)
sock.pipe(up)
})
up.on("error", () => sock.destroy())
})
await new Promise<void>((r) => proxy.listen(18080, "127.0.0.1", r))
process.env.HTTP_PROXY = process.env.HTTPS_PROXY = "http://127.0.0.1:18080"
process.env.NO_PROXY = "localhost"
// 1. Regular HTTP egress (what webfetch / provider calls use) goes through the proxy.
const body = await fetch("http://target.internal:18081/").then((r) => r.text(), (e) => `ERROR ${e}`)
console.log("fetch via proxy env:", JSON.stringify(body.trim()), "| proxy log:", log)
// 2. Browser tunnel egress for the same host.
log.length = 0
const tunnels = BrowserTunnel.make()
const result = await Effect.runPromise(
tunnels.open({ host: "target.internal", port: 18081 }).pipe(
Effect.map((id: string) => `opened ${id}`),
Effect.catch((e: Error) => Effect.succeed(`FAILED: ${e.message}`)),
),
)
console.log("BrowserTunnel.open:", result, "| proxy log:", log)
console.log(log.length === 0 ? "BUG: tunnel never contacted the configured proxy" : "OK: tunnel used the proxy")
proxy.close()
target.close()
process.exit(0)
Run it: bun tunnel-proxy.ts
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|