From d5ce8775beedde0578a0a619c1670eb4d99b3ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E6=98=8E=E5=85=83?= Date: Thu, 2 Jul 2026 09:40:30 +0800 Subject: [PATCH] feat: add --base-path support for reverse proxy sub-path deployment Allow the web UI to be served behind a reverse proxy under a sub-path (e.g. https://example.com/opencode/) without rebuilding the binary. How it works: - The server injects the configured base path into index.html at runtime via a + diff --git a/packages/app/src/app.tsx b/packages/app/src/app.tsx index 4ab0a95c23e0..8e2fa92b24f4 100644 --- a/packages/app/src/app.tsx +++ b/packages/app/src/app.tsx @@ -467,6 +467,7 @@ export function AppInterface(props: { servers?: Array router?: Component disableHealthCheck?: boolean + basePath?: string }) { // The visual new layout lives in the router root so it remains mounted across // route changes. Draft and session routes override only their server-bound data @@ -492,6 +493,7 @@ export function AppInterface(props: { ( diff --git a/packages/app/src/entry.tsx b/packages/app/src/entry.tsx index c41c1bb4b63e..929ea19c986d 100644 --- a/packages/app/src/entry.tsx +++ b/packages/app/src/entry.tsx @@ -99,11 +99,33 @@ if (!(root instanceof HTMLElement) && import.meta.env.DEV) { throw new Error(getRootNotFoundError()) } +/** + * Read the runtime base path injected by the server into the