Skip to content

feat(dashboard): work under a reverse-proxy path prefix - #2524

Open
Amronos wants to merge 1 commit into
vercel-labs:mainfrom
Amronos:dashboard-relative-paths
Open

Amronos wants to merge 1 commit into
vercel-labs:mainfrom
Amronos:dashboard-relative-paths

Conversation

@Amronos

@Amronos Amronos commented Nov 10, 2026

Copy link
Copy Markdown

Problem

The dashboard can't be served under a path prefix. Behind a reverse proxy that mounts it at https://tools.example.com/agent-browser/, the page loads but stays unstyled and disconnected: the HTML, JS chunks, favicon and logos point at /_next/..., /favicon.ico and /providers/..., and the client calls /api/... and ws://<host>/api/session/<port>/stream from the origin root. Today a proxy has to rewrite those strings in the served HTML and JS.

#1159 tried to solve this with a build-time placeholder that the Rust server replaced in every response. It was opened before #1111 merged and has not been updated since April, so it no longer applies to cli/src/native/stream/.

Changes

The dashboard is a single static page, so every URL can be relative to that page. No flag, environment variable or server change is needed, and at / every URL resolves to the same path as before.

  • next.config.ts: assetPrefix: ".". The exported HTML, the Turbopack chunk loader and the CSS now load ./_next/....
  • getDashboardApiPath returns ./api/.... exec.ts and chat.ts use it instead of hardcoded /api/... strings. getSessionStreamUrl resolves the stream path against window.location and switches the scheme to ws:/wss:.
  • The favicon moves from src/app/ to public/ and is set with metadata.icons: "./favicon.ico", because Next always emits a root-absolute link for src/app/favicon.ico. Engine and provider logos use ./ paths.
  • Docs: dashboard.mdx, skill-data/core/references/commands.md and dashboard --help explain how to proxy under a prefix (strip it before forwarding, forward WebSocket upgrades, keep the trailing slash, and insert the path before the access URL's fragment).

Verification

I built the dashboard with pnpm build and served out/ through a small Node reverse proxy. The proxy stripped /agent-browser/ and forwarded /api/ and WebSocket upgrades to agent-browser dashboard start --port 4949 (v0.41.2) with an open Chrome session.

Before (main) under /agent-browser/:

Before: unstyled, disconnected

After under /agent-browser/, the page loads styled and the stream connects at ws://127.0.0.1:8090/agent-browser/api/session/41191/stream. Adding a tab sent POST /agent-browser/api/exec. Every request the page made stayed under the prefix.

After: dashboard working under /agent-browser/

The same build at / requests /favicon.ico, /api/sessions, /api/chat/status, /api/session/<port>/tabs, /api/models and ws://<host>/api/session/<port>/stream, the same URLs as before. next dev still serves the dashboard at /. pnpm --filter docs test, type-check, build and test:routes pass.

Refs #1129 (now discussion #2378).

Written by Opus 5.5 (opus-5.5) through Sprocket.

Load the dashboard's assets, API, stream, favicon and logos from URLs
relative to the page so a reverse proxy can mount it under a path such as
/agent-browser/. Root-path behavior is unchanged.

Co-authored-by: usesprocket[bot] <306702232+usesprocket[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

@Amronos is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant