Chrome headless mode: selecting implementation for zero‑downtime migration
0 reputation · 30 Jun 2025, 00:50 UTC
0 reputation · 30 Jun 2025, 00:50 UTC
Run smoke tests for a small web application in a CI pipeline while keeping user traffic uninterrupted.
--no-sandbox but this weakens protection.The new --headless=new implementation offers near‑headed fidelity but consumes more resources, whereas the legacy headless path (removed in recent releases) was lighter but lacked some rendering features. Chrome for Testing provides a pinned distribution aimed at automation but its behavior relative to the regular Chrome binary is still being clarified in the context of a zero‑downtime migration.
--disable-gpu, --dump-dom, --remote-debugging-port) best balance fidelity, resource usage, and security in this scenario?31775 reputation · 30 Jun 2025, 11:37 UTC
Use Chrome for Testing as the distribution and run it with --headless=new as the mode. These are not competing choices: Chrome for Testing (CfT) is a version-pinned binary built for automation, while --headless=new selects the headless implementation that shares the full browser engine with headed Chrome. Together they give you the closest production parity your rehearsal can achieve, with a pinned version that will not shift mid-migration.
The legacy headless mode was a separate, lighter implementation with known rendering differences, and it has been removed from recent Chrome releases, so it is not a viable migration target. The new headless mode exercises the same rendering and network stack as headed Chrome, which is what "parity with production" actually means. CfT removes the other risk: a regular Chrome install auto-updates, and an update landing between rehearsal and cutover invalidates your validation. Pinning a CfT version in the CI image (verify with google-chrome --version or the CfT binary's equivalent) keeps the rehearsal and the cutover on identical bits.
--headless=new — full-engine fidelity.--disable-gpu — standard in Linux containers without GPU access; historically required on some setups and still a safe default for headless CI. It does not change DOM or layout results in software rendering.--remote-debugging-port — needed if you drive the browser via CDP (Puppeteer/Playwright) or want to capture traces during rehearsal. Omit it for simple --dump-dom smoke checks.--no-sandbox — avoid if possible. Prefer a container runtime that allows the sandbox (unprivileged user namespaces enabled, or a seccomp profile permitting Chrome's syscalls). If your CI kernel forbids it, --no-sandbox is a common fallback, but only run tests against content you control, never arbitrary user-submitted pages.--headless=new at the same pinned version.--dump-dom for key routes.This assumes a current Chrome release (roughly 2024 or later) where legacy headless is gone and --headless=new is the default headless behavior. Flag names and defaults have shifted across releases, so confirm against the exact pinned version's --help output and release notes before locking the image. The one detail that could change this advice: if your production users are on a materially older Chrome, pin CfT to that version rather than the latest, since parity with your users matters more than parity with the newest release.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.