-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
Apparently Chrome now hard-codes 127.0.0.1 internally for security purpose and --remote-debugging-address is removed entirely. I noticed this while trying to use --remote-debugging-address=0.0.0.0 for docker playwright without network_mode: host in #9702
The logging here confused me, so this should be removed after confirming if any current chrome doesn't support this.
vitest/packages/browser-webdriverio/src/webdriverio.ts
Lines 219 to 226 in 395d1a2
| // NodeJS equivalent defaults: https://nodejs.org/en/learn/getting-started/debugging#enable-inspector | |
| const port = inspector.port || 9229 | |
| const host = inspector.host || '127.0.0.1' | |
| args.push(`--remote-debugging-port=${port}`) | |
| args.push(`--remote-debugging-address=${host}`) | |
| this.project.vitest.logger.log(`Debugger listening on ws://${host}:${port}`) |
vitest/packages/browser-playwright/src/playwright.ts
Lines 183 to 191 in 395d1a2
| // NodeJS equivalent defaults: https://nodejs.org/en/learn/getting-started/debugging#enable-inspector | |
| const port = inspector.port || 9229 | |
| const host = inspector.host || '127.0.0.1' | |
| launchOptions.args ||= [] | |
| launchOptions.args.push(`--remote-debugging-port=${port}`) | |
| launchOptions.args.push(`--remote-debugging-address=${host}`) | |
| this.project.vitest.logger.log(`Debugger listening on ws://${host}:${port}`) |
Reproduction
Did quite a digging locally. Some notes based on AI collaboration.
🤖 Chromium DevTools bind behavior (remote debugging)
Chromium DevTools bind behavior (remote debugging)
Scope
This note documents Chromium/Chrome behavior for DevTools HTTP remote debugging bind address.
This is intentionally about Chromium behavior itself, not Playwright run-server wrapper behavior.
Findings
-
Chromium DevTools HTTP server is implemented to bind localhost by default in both major code paths:
- Chrome browser path:
chrome/browser/devtools/remote_debugging_server.cc - Headless shell path:
headless/lib/browser/headless_devtools.cc
- Chrome browser path:
-
In both files, the socket factory tries:
127.0.0.1- then
::1
-
The headless implementation has no handling for
--remote-debugging-addressin this path. -
--remote-debugging-addresswas a real/legit Chromium flag historically, but support was intentionally removed in old headless:- Commit:
6fee475feb9bc9aaded8f9b6443d18edb22de86b - Patch:
6fee475feb9bc9aaded8f9b6443d18edb22de86b^! - Subject:
[headless] Remove --remote-debugging-address support from old headless - Rationale from commit message: unprotected remote access to CDP was considered too dangerous.
- Commit:
-
Practical runtime observation (container):
/proc/net/tcpshowed0100007F:240Dwhile debugging (240D= 9229), i.e. listener bound to127.0.0.1:9229.curl http://127.0.0.1:9229/json/listworked inside container.- Host access via Docker bridge port publishing for
9229failed/reset.
Conclusion
For this Chromium execution path, DevTools remote debugging endpoint is loopback-bound in practice.
As a result, bridge-mode Docker ports: "9229:9229" is not sufficient unless traffic can reach container loopback (which it normally cannot).
network_mode: host works because loopback binding becomes reachable from host namespace.
Historically, this was not a hallucination: the address flag existed, but Chromium tightened behavior and removed support in relevant headless paths.
Also, Chromium CLI parsing is generally permissive, so unsupported/ignored switches are often not hard-rejected by startup.
Evidence pointers
- Chromium source:
chrome/browser/devtools/remote_debugging_server.ccheadless/lib/browser/headless_devtools.cc- removal commit:
6fee475feb9bc9aaded8f9b6443d18edb22de86b
- Runtime check:
/proc/net/tcpentry0100007F:240Dcurl http://127.0.0.1:9229/json/list(inside container)
System Info
naUsed Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.