Closed general

Web View proxy mode can't host the wiki: the page's path is /webview-proxy

John Lauer · 13d ago ·closed by John Lauer

Web View proxy mode can't host the Adom wiki: the page always believes its path is /webview-proxy.

Found while porting the webview postMessage action (adom/wiki#222) to HD, 1.0.584 on ConfRoomROG.

HD's proxy mode points the iframe at the control API: http://127.0.0.1:47084/webview-proxy?url=<page>. That handler fetches one HTML document and returns it.

  • Fixed in 1.0.584: the page's root-relative assets resolved against 127.0.0.1 and 404'd, so the wiki had no styles and no script. Proxied HTML now gets a <base href> at the page's real address.
  • Still broken: location.pathname is /webview-proxy. The wiki routes by path, so:
    • drive page answers { "path": "/webview-proxy", "ref": null };
    • drive ready --viewer 3d fails with "3d viewer start did not happen within 30 s";
    • orbit and datasheet calls fail the same way. eval (which answers unknown method) and the timeout cases behave correctly. Requests the page makes (API, GLB) also go out from the loopback origin, so CORS may block them too.

With proxy mode off (the default), the whole adom/wiki#222 test list passes on 1.0.584.

What a real fix needs: a path-preserving proxy, for example /webview-proxy/<scheme>/<host>/<path>?<query>, that rewrites or forwards sub-requests so the page keeps its own path. The in-page navigation tracking in PanelWebView (onParentProxy, which checks pathname === '/webview-proxy') would have to follow it.

Until then, an agent that drives wiki pages should leave proxy mode off.

1 Reply

John Lauer · 13d ago

Fixed in 1.0.585 (insiders), commit c2147570.

Proxy mode no longer frames the control API's /webview-proxy?url=. Each site now gets its own loopback origin on hydrogen-proxy: http://<base32 of the site origin>.wvp.localhost:47083/<real path>.

  • The page keeps its real path. The wiki now knows which page it is on, and its viewers start.
  • Assets and API calls come back through the same origin. It is a full reverse proxy: methods, bodies and cookies pass through, framing headers are dropped, and redirects stay inside the proxy.
  • Navigation and scroll tracking now work. The proxy injects the __adom_webview tracker, so in-page navigation and scroll report the page's real address. HD's old trust check read a cross-origin location and never passed.
  • Security: the old design ran a proxied page's scripts on the control API's own origin, which Hydrogen trusts. hydrogen-control now refuses *.wvp.localhost origins, and /webview-proxy (now fetch-only, for favicons) serves HTML with CSP: sandbox.

Verified on ConfRoomROG 1.0.585, proxy mode on:

  • page answers adom/stm32f303cbt6.
  • 3D ready: loaded: true.
  • Orbit 360/6 s answered in 6.11 s.
  • Datasheet page 3/148.
  • GET /health with a *.wvp.localhost Origin: 403. With tauri.localhost: 200.

Log in to reply.