Public: anyone can read this; the crew can change it.

Inside a child cell, the looks browser cannot reach the child's own app (net::ERR_INTERNET_DISCONNECTED) #10610

Parked opened this in answer to
Closed without merging

Inside a cell, [looks] now opens the forge's port by its loopback address, not by the app's hostname. I couldn't confirm it fixes the real failure, because I had no cell to try it in and Chromium won't start in my sandbox. Cause (my best reading).

Notes

stopped parked by the crew deploy 5bccf70

opened this

Inside a cell, [looks] now opens the forge's port by its loopback address, not by the app's hostname. I couldn't confirm it fixes the real failure, because I had no cell to try it in and Chromium won't start in my sandbox.

Cause (my best reading). The browser was already pointed at the forge's own local port. It already mapped the app's hostname to 127.0.0.1. Chromium treats a network with only loopback as offline. I believe that makes it refuse the hostname with ERR_INTERNET_DISCONNECTED even though the name resolves to loopback. I did not check Chromium's source. An address literal needs no lookup, so it should avoid that.

What changed (src/looks/capture.ts):

  • When the machine's only network interface is lo, the browser opens http://127.0.0.1:<port>/__forge/grant…. The app's real host:port goes in a Host header, set through DevTools Network.setExtraHTTPHeaders. The forge's host-based routing, the grant door and the page-host refusal check all still work.
  • A new optional LookInput.byAddress forces or disables this. When unset, it is on only if /sys/class/net shows nothing but lo.
  • Outside a cell the code path is unchanged.
  • The cell gains no network: the browser only ever contacts 127.0.0.1 on the forge's port, as before.

Tests. test/look-by-address.test.ts checks the loopback-only detection and the URL and Host rewrite. It also runs a real capture of a Host-routed server by address, and checks that the server only ever saw the app's Host.

  • tsc and scripts/gate.ts are clean.
  • The real-capture tests cannot run here: Chromium fails with process_singleton … socket() failed: Operation not permitted. That includes my new one, and three existing tests in test/looks.test.ts that already failed without my change. The forge's check will be the first real run of the browser path.

Not done. I did not try the other route, an interception layer that serves the page without the browser touching the network.

To try: after merge, trigger a look on a child cell's app, such as scottishbob's diagnostics.

Closes #10557

3 earlier comments
commented

Inside a cell, [looks] now opens the forge's port by its loopback address, not by the app's hostname. I couldn't confirm it fixes the real failure, because I had no cell to try it in and Chromium won't start in my sandbox.

Cause (my best reading). The browser was already pointed at the forge's own local port. It already mapped the app's hostname to 127.0.0.1. Chromium treats a network with only loopback as offline. I believe that makes it refuse the hostname with ERR_INTERNET_DISCONNECTED even though the name resolves to loopback. I did not check Chromium's source. An address literal needs no lookup, so it should avoid that.

What changed (src/looks/capture.ts):

  • When the machine's only network interface is lo, the browser opens http://127.0.0.1:<port>/__forge/grant…. The app's real host:port goes in a Host header, set through DevTools Network.setExtraHTTPHeaders. The forge's host-based routing, the grant door and the page-host refusal check all still work.
  • A new optional LookInput.byAddress forces or disables this. When unset, it is on only if /sys/class/net shows nothing but lo.
  • Outside a cell the code path is unchanged.
  • The cell gains no network: the browser only ever contacts 127.0.0.1 on the forge's port, as before.

Tests. test/look-by-address.test.ts checks the loopback-only detection and the URL and Host rewrite. It also runs a real capture of a Host-routed server by address, and checks that the server only ever saw the app's Host.

  • tsc and scripts/gate.ts are clean.
  • The real-capture tests cannot run here: Chromium fails with process_singleton … socket() failed: Operation not permitted. That includes my new one, and three existing tests in test/looks.test.ts that already failed without my change. The forge's check will be the first real run of the browser path.

Not done. I did not try the other route, an interception layer that serves the page without the browser touching the network.

To try: after merge, trigger a look on a child cell's app, such as scottishbob's diagnostics.

commented

I pushed a diagnostic commit, not a fix. The by-address capture test is still failing in the check. I can't see why, because Chromium won't start in my sandbox: chromium exited 134 … socket() failed: Operation not permitted.

What the push does:

  • Test messages: the test now puts the capture's error and the Host headers the server saw into its failure message. The next check log will say whether the capture failed outright or Chromium ignored the Host override.
  • Code: nothing in src/looks/capture.ts changed.
  • Likely cause: my best guess is that Chromium ignores the Host header I set through DevTools. That is an unconfirmed guess.

If the log shows the Host override is ignored, my fallback is a small loopback-only HTTP proxy in the capture. The browser would send its traffic through it with --proxy-server, and the proxy would forward to the forge's port with the app's Host. I haven't built that.

commented

The by-address capture test is still failing in the check, and I haven't fixed it. The check log doesn't include my failure message, so I can't see why. Chromium won't start in my sandbox (socket() failed: Operation not permitted), so I can't run the capture myself.

I pushed a change to test/look-by-address.test.ts so the next log shows the cause. The test now runs the capture when the file loads and puts the result in its name. The result is either "ok" or the capture's error, plus whether a picture file was written and the Host header of each request the server saw. A failed test's name appears in the check log, so the next failure will say what happened.

The code in src/looks/capture.ts is unchanged. I still guess that Chromium ignores the Host header I set through DevTools.

If the new name shows Host was not applied, I'll replace that step with a loopback-only HTTP proxy that forwards to the forge's port with the app's Host. If it shows a different error, I'll fix that instead. I need the next failing log to choose.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs