diff --git a/packages/cli/src/capture/launchCaptureBrowser.test.ts b/packages/cli/src/capture/launchCaptureBrowser.test.ts index bda3c78f9e..2f067e19ae 100644 --- a/packages/cli/src/capture/launchCaptureBrowser.test.ts +++ b/packages/cli/src/capture/launchCaptureBrowser.test.ts @@ -67,6 +67,16 @@ describe("capture browser transport lifecycle", () => { await session.close(); }); + // fails without the fix: a local page server on its scheme's default port gave a bypass entry with no port, which + // Chrome takes as every port on that host. + it("names a local page server's default port in its bypass entry", async () => { + const session = await launchCaptureBrowser({ ...options, localOrigin: "http://localhost" }); + expect(mocks.launch.mock.calls[0]?.[1].args).toContain( + "--proxy-bypass-list=<-loopback>;localhost:80", + ); + await session.close(); + }); + // A profile directory the OS refuses to empty stands in for Windows' locked Chrome lockfile. it.runIf(process.platform !== "win32" && process.getuid?.() !== 0)( "finishes a close whose profile directory cannot be removed, with a warning", diff --git a/packages/cli/src/capture/launchCaptureBrowser.ts b/packages/cli/src/capture/launchCaptureBrowser.ts index fe6a9c2a8d..fc626f7149 100644 --- a/packages/cli/src/capture/launchCaptureBrowser.ts +++ b/packages/cli/src/capture/launchCaptureBrowser.ts @@ -9,6 +9,7 @@ import { settleAcrossNavigation } from "./navigateForCapture.js"; import { browserProxyArgs, createPublicOnlyProfile, + pageServerDirectHost, startCaptureProxy, } from "@hyperframes/engine/public-network"; import { removeTreeBestEffortAsync } from "@hyperframes/core/remove-tree"; @@ -55,7 +56,7 @@ export async function launchCaptureBrowser(options: { ...captureBrowserArgs(options.disableWebgl, options.width, options.height), ...browserProxyArgs( proxy.url, - options.localOrigin ? new URL(options.localOrigin).host : undefined, + options.localOrigin ? pageServerDirectHost(options.localOrigin) : undefined, ), ], });