Skip to content

fix: bind the report server where DDEV's router can reach it - #142

Draft
deviantintegral wants to merge 3 commits into
mainfrom
fix/show-report-host-binding
Draft

fix: bind the report server where DDEV's router can reach it#142
deviantintegral wants to merge 3 commits into
mainfrom
fix/show-report-host-binding

Conversation

@deviantintegral

Copy link
Copy Markdown
Member

ddev playwright show-report --host=127.0.0.1, which the README has recommended since #93, serves the HTML report on the web container's own loopback interface. DDEV's router connects to that container over the Docker network instead, so it never reaches the report server and answers the routed URL with a 502 Bad Gateway -- the symptom reported in #103.

show-report now defaults to --host=0.0.0.0, so it needs no flag at all. That does not expose the report to the host network either: container port 9323 is not published, leaving the router as the only way in. An explicit --host or --port is still honoured, with a note saying why it will not be reachable, rather than silently overridden.

Playwright's own "Serving HTML report at http://0.0.0.0:9323" line is accurate but describes the in-container address, and #103 found that confusing next to the 9324 in ddev describe. Print the routed URL immediately above it and label the line below for what it is.

The new test asserts against the routed URL rather than the container port, since a request straight to 9323 succeeds under either binding and would catch nothing. The testdata configs gain the html reporter, with open: 'never' so a failing run cannot start a report server the suite would then wait on.

Refs #103

Claude-Session: https://claude.ai/code/session_01YZyXTWUBXi2LAkbf1kaC2D

deviantintegral and others added 3 commits August 20, 2026 13:18
`ddev playwright show-report --host=127.0.0.1`, which the README has
recommended since #93, serves the HTML report on the web container's own
loopback interface. DDEV's router connects to that container over the
Docker network instead, so it never reaches the report server and answers
the routed URL with a 502 Bad Gateway -- the symptom reported in #103.

show-report now defaults to --host=0.0.0.0, so it needs no flag at all.
That does not expose the report to the host network either: container port
9323 is not published, leaving the router as the only way in. An explicit
--host or --port is still honoured, with a note saying why it will not be
reachable, rather than silently overridden.

Playwright's own "Serving HTML report at http://0.0.0.0:9323" line is
accurate but describes the in-container address, and #103 found that
confusing next to the 9324 in `ddev describe`. Print the routed URL
immediately above it and label the line below for what it is.

The new test asserts against the routed URL rather than the container
port, since a request straight to 9323 succeeds under either binding and
would catch nothing. The testdata configs gain the html reporter, with
open: 'never' so a failing run cannot start a report server the suite
would then wait on.

Refs #103

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZyXTWUBXi2LAkbf1kaC2D
Appending --host=0.0.0.0 to the user's arguments meant the wrapper had to
know whether they had already passed --host, in either spelling, and had
to special-case a trailing --host with no value -- which would otherwise
swallow the injected default as its own argument.

Playwright's last --host wins (verified against 1.62.1, both --host=VALUE
and --host VALUE), so prepending the default instead lets its parser
settle precedence. The bookkeeping that existed only to decide whether to
inject goes away, and the argument scan that remains serves the advice
message alone rather than control flow.

Also from the review passes:

- report_url() reads DDEV_PRIMARY_URL_WITHOUT_PORT rather than re-deriving
  the primary hostname by splitting DDEV_HOSTNAME on commas, which meant
  owning DDEV's rules for hostname ordering. Older releases that set only
  DDEV_PRIMARY_URL still work.
- The router-topology explanation was written out three times. It stays
  where the binding is chosen; the test points at it.
- The README now states the rule rather than the one instance: any server
  started in the container must bind 0.0.0.0 and use a routed port.
  `test --ui` and `show-trace` default to localhost and hit the identical
  502, so both are documented with flag names checked against the CLI.
- curl --max-time in the readiness poll, so the stated budget is a real
  ceiling rather than one that a hung router could overrun by minutes.
- pkill -f '[p]laywright...' so the pattern cannot match the command line
  of the ddev exec wrapper running it.

Recorded in a comment that this cannot be done in configuration:
show-report reads neither playwright.config.ts nor PLAYWRIGHT_HTML_HOST,
so the CLI flag is the only lever.

Refs #103

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZyXTWUBXi2LAkbf1kaC2D
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZyXTWUBXi2LAkbf1kaC2D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant