fix(e2e): chromedriver proxy host/origin, docker exec output, host-access skip, devtoolsproxy timeout#282
Merged
Merged
Conversation
…omeDriver accepts proxied requests
The ChromeDriver proxy fronts the internal `chromedriver --port=9225` on
:9224. ChromeDriver (Chrome 111+) rejects any request whose Host/Origin
header is not localhost or an IP, returning HTTP 500 with body "Host
header or origin header is specified and is not whitelisted or localhost"
(DNS-rebinding protection).
The reverse-proxy Rewrite did `r.Out.Host = r.In.Host`, which overrode
the loopback host that SetURL had set, forwarding the inbound Host to
ChromeDriver. Over a direct 127.0.0.1 connection (docker e2e) the inbound
Host is already loopback so it works, but behind an ingress (e.g.
{instance}.dev-yul-hypeman-1.kernel.sh:9224, the hypeman e2e path) the
real hostname gets forwarded and ChromeDriver 500s every request. This
looked like a slow/never-ready chromedriver because WaitChromeDriver
polls /status for a 200 that never comes.
handleCreateSession had the same class of bug: it copied all client
headers (including Origin) to the upstream.
Fix: drop the `r.Out.Host = r.In.Host` line so the upstream sees the
loopback Host, strip the Origin header in the rewrite, and skip the
Origin header in handleCreateSession's header-copy loop. Adds a
regression test (TestHandler_RewritesHostAndStripsOrigin) exercising both
the reverse-proxy path and POST /session with an ingress Host/Origin.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Created a monitoring plan for this PR. What this PR does: Fixes Selenium/WebDriver session creation inside browser VMs when the VM is accessed via an ingress hostname rather than a direct loopback connection — unblocking the hypeman e2e test path and any production customer using the WebDriver protocol behind an ingress. Intended effect:
Risks:
Status updates will be posted automatically on this PR as monitoring progresses. |
dockerBackend.Exec returned the raw multiplexed Docker stream, so callers that parse Exec output saw Docker's 8-byte frame headers interleaved with the data. Use testcontainers exec.Multiplexed() to demultiplex into clean combined stdout+stderr, matching what tests expect. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ds without it Mirrors the host-access handling from the private hypeman-e2e work so the two repos' e2e Backend surface stays identical (no sync drift). Add Backend.SupportsHostAccess() (docker=true, hypeman=false) and have TestContainer.Start t.Skip when a test requests ContainerConfig.HostAccess on a backend that can't bridge the instance to a service on the test host. Keyed on the request, so a test that doesn't ask for HostAccess is never skipped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tnsardesai
approved these changes
Jun 10, 2026
TestUpstreamManagerDetectsChromiumAndRestart launches a real browser and waits for UpstreamManager to scrape the "DevTools listening on ws://..." line. On shared CI runners chromium cold-start has a long tail: recent runs printed the line in ~6s warm but 15-17s when contended, occasionally exceeding the 20s budget and failing at exactly ~20.15s — a timeout, not a missing line. Raise the wait to 60s (still fails fast if the browser truly never starts). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several related e2e/server fixes (the shared/upstream-appropriate pieces of the hypeman-e2e work, plus a pre-existing CI flake).
1. ChromeDriver proxy forwards a non-loopback Host/Origin (HTTP 500)
ChromeDriver (Chrome 111+) rejects requests whose
Host/Originisn't localhost/an IP ("Host header or origin header ... not whitelisted or localhost", HTTP 500). The:9224proxy didr.Out.Host = r.In.Host, forwarding the inbound host; over a direct127.0.0.1hit (docker) that's loopback so it works, but behind an ingress it 500s every request (looks like a slow/never-ready chromedriver). Fix: keepSetURL's loopback host and stripOrigin, in both the reverse-proxy path andhandleCreateSession. Adds a regression test.2. Docker exec output includes stream-multiplexing headers
dockerBackend.Execreturned the raw multiplexed Docker stream. Use testcontainersexec.Multiplexed()for clean combined stdout+stderr.3. Backend.SupportsHostAccess + skip host-access tests on backends without it
Adds
Backend.SupportsHostAccess()(docker=true, hypeman=false);TestContainer.Startt.Skips when a test requestsHostAccesson a backend that can't bridge to the runner's loopback. Keyed on the request, so a test that doesn't ask for HostAccess is never skipped.4. devtoolsproxy: raise UpstreamManager detect timeout 20s -> 60s
TestUpstreamManagerDetectsChromiumAndRestartis a pre-existing flake onmain: it launches a real browser and waits for theDevTools listening on ws://...line, but chromium cold-start has a long tail on shared CI runners (recent runs: ~6s warm, 15-17s contended, occasionally >20s — failing at exactly ~20.15s, a timeout not a missing line). Raise the wait to 60s. (Supersedes #283, now closed; the browser-binary pinning explored there was unnecessary — the timeout is the real fix.)🤖 Generated with Claude Code