Repository navigation
Conversation
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>
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.icoand/providers/..., and the client calls/api/...andws://<host>/api/session/<port>/streamfrom 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/....getDashboardApiPathreturns./api/....exec.tsandchat.tsuse it instead of hardcoded/api/...strings.getSessionStreamUrlresolves the stream path againstwindow.locationand switches the scheme tows:/wss:.src/app/topublic/and is set withmetadata.icons: "./favicon.ico", because Next always emits a root-absolute link forsrc/app/favicon.ico. Engine and provider logos use./paths.dashboard.mdx,skill-data/core/references/commands.mdanddashboard --helpexplain 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 buildand servedout/through a small Node reverse proxy. The proxy stripped/agent-browser/and forwarded/api/and WebSocket upgrades toagent-browser dashboard start --port 4949(v0.41.2) with an open Chrome session.Before (main) under
/agent-browser/:After under
/agent-browser/, the page loads styled and the stream connects atws://127.0.0.1:8090/agent-browser/api/session/41191/stream. Adding a tab sentPOST /agent-browser/api/exec. Every request the page made stayed under the prefix.The same build at
/requests/favicon.ico,/api/sessions,/api/chat/status,/api/session/<port>/tabs,/api/modelsandws://<host>/api/session/<port>/stream, the same URLs as before.next devstill serves the dashboard at/.pnpm --filter docs test,type-check,buildandtest:routespass.Refs #1129 (now discussion #2378).
Written by Opus 5.5 (opus-5.5) through Sprocket.