fix(cli): capture names its local page server's port in the bypass entry (#7965)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
James Russo
2026-11-16 17:30:40 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 2623ded136
commit a9b0371c83
2 changed files with 12 additions and 1 deletions
@@ -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",
@@ -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,
),
],
});