#2152

Dashboard URLs with queries download HTML; static fallback uses the wrong MIME type

OpenCubaticaopened 11d ago

Observed at runtime on agent-browser 0.27.1 (Linux x86_64). The relevant request parser and serve_embedded_file logic remain unchanged in v0.39.1 source (1165952d74ceed98fdc2dd97190ad41f44dd0e24); v0.39.1 was not installed or runtime-tested.

Reproduce with a running dashboard:

curl -sSI http://127.0.0.1:4848/
curl -sSI 'http://127.0.0.1:4848/?port=35511'

Expected: both return HTML with Content-Type: text/html; charset=utf-8.

Observed: both return 200 and the same 16,987-byte HTML document, but the query URL has Content-Type: application/octet-stream, so Chrome downloads it.

Cause: cli/src/native/stream/dashboard.rs::parse_request_method_and_path retains the query in the request target. cli/src/native/stream/http.rs::serve_embedded_file uses that target as an embedded-asset key, falls back to index.html, then derives MIME from the failed key instead of the file served. Query-bearing JS/CSS URLs and extension-shaped missing routes share the mismatch.

Suggested fix: strip the query before asset lookup, and derive MIME from the resolved asset, including the HTML fallback. Regression cases: root with query has identical bytes and HTML MIME; a real JS asset with a query preserves JS bytes/MIME; a missing .js path falling back to HTML returns HTML MIME.

Workaround: open the dashboard root without a query and select the discovered session. All session traffic stays on the dashboard origin.

Source references:

Activity

0

No activity yet.