Conversation
Redirect detection fetched the document from Node and fulfilled the navigation with it. A fulfilled document has no remote address, so Chromium places it in the public address space, and its local network access checks then block every request the page makes to an origin on a private address. Rendering a Docker service name or any other internal host over plain http returned the page shell with a 200 and no content. Loopback is exempt from those checks, which is why the integration suite never saw it. The document request is now paused through CDP at the response stage and released untouched unless it is a redirect, so the browser receives it from the network. Redirects Chromium makes itself, such as an HSTS upgrade, are asked of the origin from Node so the origin's own status is still what gets reported.
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.
Fixes #20
With the default settings, pages served from a private network address over plain http rendered as an empty shell. Redirect detection fulfilled the navigation with a document fetched from Node. Chromium places a fulfilled document in the public address space, and its local network access checks then blocked the page's scripts and stylesheets. The issue has a reproduction and the console error.
Change
installRedirectDetectionno longer fetches and fulfills the document. It opens a CDP session and enablesFetchforDocumentrequests at the response stage.Aborted.gotothen rejects, andrenderPagealready treats that as a redirect result.The destination of a redirect is still never requested.
One case needs the origin asked separately: redirects Chromium makes itself. For an HSTS-preloaded host such as
http://github.com/, Chromium never sends the http request. It pauses on a synthetic307 Internal RedirectmarkedNon-Authoritative-Reason: HSTS. Reporting that would turn the origin's 301 into a 307, which the Docker smoke test caught. For those, the origin is asked from Node withpage.request.fetch(url, { maxRedirects: 0 }), the same requestroute.fetchmade before. Its answer is only read, never given to the page. If the origin does not redirect or cannot be reached, the browser's own redirect is followed.Other details:
page.route('**/*'), so the comment about registration order is gone. An integration test covers both interceptions active at once.Tests
an origin on a private network addressblock serves the fixture from the machine's first private IPv4 address and renders a page whose content comes from an external script. It fails onmainand passes here. It is skipped on a machine without a private address; GitHub's hosted runners have one.renderPageandrendererfakes now stand in for a CDP session instead of a route. New cases cover:npm run lint,typecheck,format:check,test:coverage,build,check:packaging,test:integrationandscripts/docker-smoke.shall pass locally. I also checked the built image against a real app behind Caddy on a Docker network: its pages now render with the default settings, and a real origin's308to https is reported as the origin sent it.A changeset marks this as a patch.