Problem
When running opencode web behind a reverse proxy that adds a path prefix (e.g. https://host/notebook-sessions/<id>/ports/4096/), the web UI breaks. The HTML is served at the prefixed URL but all assets use absolute root paths (/assets/index-xxx.js), so the browser fetches them from the host root and gets 404s.
Proposed solution
Add a --base-path CLI flag, OPENCODE_SERVER_BASE_PATH env var, and server.basePath config option. When set, the server injects a <base href="/the/prefix/"> tag into every HTML response. Browsers resolve all asset and navigation URLs relative to that base, so no rebuild is needed. The SolidJS Router is also given the base so client-side routing stays within the prefix.
Usage
# CLI flag
opencode web --base-path /notebook-sessions/abc123/ports/4096
# Env var
OPENCODE_SERVER_BASE_PATH=/notebook-sessions/abc123/ports/4096 opencode web
# opencode.json
{ "server": { "basePath": "/notebook-sessions/abc123/ports/4096" } }
Problem
When running
opencode webbehind a reverse proxy that adds a path prefix (e.g.https://host/notebook-sessions/<id>/ports/4096/), the web UI breaks. The HTML is served at the prefixed URL but all assets use absolute root paths (/assets/index-xxx.js), so the browser fetches them from the host root and gets 404s.Proposed solution
Add a
--base-pathCLI flag,OPENCODE_SERVER_BASE_PATHenv var, andserver.basePathconfig option. When set, the server injects a<base href="/the/prefix/">tag into every HTML response. Browsers resolve all asset and navigation URLs relative to that base, so no rebuild is needed. The SolidJS Router is also given the base so client-side routing stays within the prefix.Usage