From 99c8bb65633c5796b1df19f84e1f282ecc12b794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 10 Feb 2026 11:39:01 +0100 Subject: [PATCH] Add env var to allow external connections to `npx gulp server` Using `0.0.0.0` instead of `localhost` allows connecting from other devices, significantly simplifying testing on mobile devices. This is controlled by the `ANY_HOST` environment variable and not enabled by default, since allowing external connections comes with security implications (e.g. when on a public network without a properly configured firewall). --- test/webserver.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/webserver.mjs b/test/webserver.mjs index 52511ed637ce2..c8865916304ad 100644 --- a/test/webserver.mjs +++ b/test/webserver.mjs @@ -46,7 +46,7 @@ class WebServer { constructor({ root, host, port, cacheExpirationTime }) { const cwdURL = pathToFileURL(process.cwd()) + "/"; this.rootURL = new URL(`${root || "."}/`, cwdURL); - this.host = host || "localhost"; + this.host = host || (process.env.ANY_HOST ? "0.0.0.0" : "localhost"); this.port = port || 0; this.server = null; this.verbose = false;