From f75c48323ce65f651381c74ae75a1795e7cc5c45 Mon Sep 17 00:00:00 2001 From: Olcan Date: Wed, 11 Jun 2025 11:31:38 -0700 Subject: fixes to proxy on macos: prevent curl from hanging during wait-for-proxy by adding ipv6 support and timeout (#947) --- scripts/example-proxy.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts/example-proxy.js') diff --git a/scripts/example-proxy.js b/scripts/example-proxy.js index 284a2eed..576da849 100755 --- a/scripts/example-proxy.js +++ b/scripts/example-proxy.js @@ -6,7 +6,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -// Example proxy server that listens on 0.0.0.0:8877 and only allows HTTPS connections to example.com. +// Example proxy server that listens on :::8877 and only allows HTTPS connections to example.com. // Set `GEMINI_SANDBOX_PROXY_COMMAND=scripts/example-proxy.js` to run proxy alongside sandbox // Test via `curl https://example.com` inside sandbox (in shell mode or via shell tool) @@ -66,8 +66,9 @@ server.on('connect', (req, clientSocket, head) => { }); }); -server.listen(PROXY_PORT, '0.0.0.0', () => { - console.log(`[PROXY] Proxy listening on 0.0.0.0:${PROXY_PORT}`); +server.listen(PROXY_PORT, () => { + const address = server.address(); + console.log(`[PROXY] Proxy listening on ${address.address}:${address.port}`); console.log( `[PROXY] Allowing HTTPS connections to domains: ${ALLOWED_DOMAINS.join(', ')}`, ); -- cgit v1.2.3