π OpenHands: AI-Driven Development
Proxy agent-server FastAPI docs (/docs, /redoc, /openapi.json) through the ingress (#501)
Tim O'Farrell4db59b8b942c
diff --git a/scripts/dev-static.mjs b/scripts/dev-static.mjsindex 1beea74643..2621d0d420 100644--- a/scripts/dev-static.mjs+++ b/scripts/dev-static.mjs@@ -390,6 +390,12 @@ function startStaticServer(config) {`/ready=http://localhost:${config.agentServerPort}`,"--route",`/alive=http://localhost:${config.agentServerPort}`,+ "--route",+ `/docs=http://localhost:${config.agentServerPort}`,+ "--route",+ `/redoc=http://localhost:${config.agentServerPort}`,+ "--route",+ `/openapi.json=http://localhost:${config.agentServerPort}`,],{cwd: config.canvasPath,@@ -424,6 +430,12 @@ function startIngress(config) {`/ready=http://localhost:${config.agentServerPort}`,"--route",`/alive=http://localhost:${config.agentServerPort}`,+ "--route",+ `/docs=http://localhost:${config.agentServerPort}`,+ "--route",+ `/redoc=http://localhost:${config.agentServerPort}`,+ "--route",+ `/openapi.json=http://localhost:${config.agentServerPort}`,"--default",`http://localhost:${config.vitePort}`,],diff --git a/scripts/dev-with-automation.mjs b/scripts/dev-with-automation.mjsindex f30ed4412a..8dc5460133 100644--- a/scripts/dev-with-automation.mjs+++ b/scripts/dev-with-automation.mjs@@ -655,6 +655,12 @@ function startIngress(config) {`/ready=http://localhost:${config.agentServerPort}`,"--route",`/alive=http://localhost:${config.agentServerPort}`,+ "--route",+ `/docs=http://localhost:${config.agentServerPort}`,+ "--route",+ `/redoc=http://localhost:${config.agentServerPort}`,+ "--route",+ `/openapi.json=http://localhost:${config.agentServerPort}`,"--default",`http://localhost:${config.vitePort}`,],@@ -959,6 +965,12 @@ function startStaticFrontend(config, staticDir) {`/ready=http://localhost:${config.agentServerPort}`,"--route",`/alive=http://localhost:${config.agentServerPort}`,+ "--route",+ `/docs=http://localhost:${config.agentServerPort}`,+ "--route",+ `/redoc=http://localhost:${config.agentServerPort}`,+ "--route",+ `/openapi.json=http://localhost:${config.agentServerPort}`,],{cwd: config.canvasPath,diff --git a/scripts/static-server.mjs b/scripts/static-server.mjsindex 3d36df3d81..b0de5420c2 100644--- a/scripts/static-server.mjs+++ b/scripts/static-server.mjs@@ -4,7 +4,8 @@* Replaces `sirv-cli` for the dockerless static launcher. The reason a plain static* server is not enough: Vite's dev server (used by `npm run dev`) configures* a proxy for `/api`, `/sockets`, `/server_info`, `/alive`, `/health`,- * `/ready` (see vite.config.ts) so requests to those paths are forwarded to+ * `/ready`, `/docs`, `/redoc`, `/openapi.json` (see vite.config.ts) so+ * requests to those paths are forwarded to* the agent-server even when the browser is hitting Vite directly on :3001.* sirv-cli has no proxy support, so under `--single` it falls back to* index.html for any of those paths β making `/server_info` look like HTMLdiff --git a/vite.config.ts b/vite.config.tsindex 54fe579f5c..dc20fbb0ac 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -287,6 +287,21 @@ export default defineConfig(({ mode }) => {changeOrigin: true,secure: !INSECURE_SKIP_VERIFY,},+ "/docs": {+ target: API_URL,+ changeOrigin: true,+ secure: !INSECURE_SKIP_VERIFY,+ },+ "/redoc": {+ target: API_URL,+ changeOrigin: true,+ secure: !INSECURE_SKIP_VERIFY,+ },+ "/openapi.json": {+ target: API_URL,+ changeOrigin: true,+ secure: !INSECURE_SKIP_VERIFY,+ },"/sockets": {target: WS_URL,ws: true,