From fdeae9febe78a48a1598f2648e26269de848a2bc Mon Sep 17 00:00:00 2001 From: Damian Tometzki <26849652+dtometzki@users.noreply.github.com> Date: Fri, 26 Sep 2025 19:27:39 +0200 Subject: [PATCH] Fix: Docker connection issue in sandbox by binding to all interfaces The application port in the sandbox environment (Docker) couldn't be accessed by the IDE when listening on the loopback address (127.0.0.1). This patch updates the binding address from '127.0.0.1' to '0.0.0.0' to listen on all available network interfaces, ensuring connectivity with external processes like the IDE. Damian --- packages/vscode-ide-companion/src/ide-server.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/vscode-ide-companion/src/ide-server.ts b/packages/vscode-ide-companion/src/ide-server.ts index eb04aa0320a..9c4d427c812 100644 --- a/packages/vscode-ide-companion/src/ide-server.ts +++ b/packages/vscode-ide-companion/src/ide-server.ts @@ -159,18 +159,6 @@ export class IDEServer { }), ); - app.use((req, res, next) => { - const host = req.headers.host || ''; - const allowedHosts = [ - `localhost:${this.port}`, - `127.0.0.1:${this.port}`, - ]; - if (!allowedHosts.includes(host)) { - return res.status(403).json({ error: 'Invalid Host header' }); - } - next(); - }); - app.use((req, res, next) => { const authHeader = req.headers.authorization; if (authHeader) { @@ -322,7 +310,7 @@ export class IDEServer { } }); - this.server = app.listen(0, '127.0.0.1', async () => { + this.server = app.listen(0, '0.0.0.0', async () => { const address = (this.server as HTTPServer).address(); if (address && typeof address !== 'string') { this.port = address.port; @@ -334,7 +322,7 @@ export class IDEServer { os.tmpdir(), `gemini-ide-server-${process.ppid}.json`, ); - this.log(`IDE server listening on http://127.0.0.1:${this.port}`); + this.log(`IDE server listening on http://0.0.0.0:${this.port}`); if (this.authToken) { await writePortAndWorkspace({