Repository navigation
feat: serve under a URL path prefix with --base-path - #61624
fabiovincenzi wants to merge 15 commits into
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
We'd like to use this to run OpenCode inside marimohub, the self-hosted marimo server. It already runs VS Code next to the notebook through an authenticated proxy at On the open questions:
Things we'd depend on:
One question: does the app assume the browser's path matches the prefix the server sees? A proxy in front may strip an outer prefix first (for example, the hub served under Happy to test a build behind marimohub's proxy once #60559 lands. |
Issue for this PR
Closes #7624
Type of change
What does this PR do?
Depends on #60559, so it's a draft until that merges. Until then the diff also includes its two commits.
Adds
opencode serve --base-path /opencode, so the server and web app can run behind a reverse proxy under a path prefix./opencodeto/opencode/and returns 404 outside it.index.htmlin a<meta>tag. Scripts and styles now load their dependencies with relative URLsbasedoesn't change whatuseLocation()returns.Open questions:
--serviceis rejected, since local clients reach the managed service at its root. Should the root keep working too?Replaces #28326, which targeted V1.
How did you verify your code works?
New tests in
packages/server(base-path.test.ts),packages/cli(web-ui.test.ts) andpackages/app(base-path-router.test.ts,pairing.test.ts). Each one fails without its change.Manually behind nginx with the config from the docs: pages and reloads, the event stream and a terminal. Through a small test proxy: every lazy-loaded chunk and pairing.
Visual
N/A
Screenshots / recordings
N/A, no visual change.
Checklist