[PR #1202] [CLOSED] dashboard: Serve the web page under an optional dashboard path #3307

Closed
opened 2026-11-07 14:40:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1202
Author: @gener-vscode
Created: 10/6/2026
Status: ❌ Closed

Base: main ← Head: feat/dashboard-baseurl


📝 Commits (4)

  • a28bcd8 feat(serve): serve the web page under an optional "dashboard" path
  • 54422de fix(serve): / redirects to the dashboard path instead of answering 404
  • 0e6fe0d feat(serve): open the page on the tab the config names
  • 8937332 feat(serve): tell the page its tab, and give Chat its own address

📊 Changes

18 files changed (+265 additions, -42 deletions)

View changed files

📝 README.de.md (+2 -2)
📝 README.es.md (+2 -2)
📝 README.fr.md (+2 -2)
📝 README.ja.md (+2 -2)
📝 README.md (+2 -2)
📝 README.pt-BR.md (+2 -2)
📝 README.zh-CN.md (+2 -2)
📝 docs/AI_SETUP.md (+2 -2)
📝 docs/DETAILS.md (+25 -1)
📝 docs/INSTALL.md (+2 -2)
📝 serve/server.py (+128 -8)
📝 serve/test_monitor.py (+1 -1)
📝 serve/test_server.py (+70 -1)
📝 serve/web/app.js (+6 -3)
📝 serve/web/monitor.html (+2 -2)
📝 serve/web/monitor.js (+3 -3)
📝 setup.py (+1 -1)
📝 sycl/serve/server_intel.py (+11 -4)

📄 Description

What

The web page answered only at /, so nothing else could hold that address on the same port. A run-config key "dashboard" (or serve/server.py --dashboard /ui) now serves the page under a path of the user's choosing, together with the files the page loads for itself:

with "dashboard": "/ui" answer
/ui/ the chat page (Chat / Monitor / About)
/ui/web/app.js, /ui/web/app.css, /ui/web/sprite.svg, /ui/fonts/* the styles, script, sprite and font the page loads itself
/ and /ui, asked with GET 301 to /ui/, keeping a ?q= that came with it (/?q=hi to /ui/?q=hi)
/v1/chat/completions, /v1/messages, /v1/responses, /health, /metrics, /status, /slots, /props, /models, /mcp, /load, /unload unchanged, at / as they always were; the same paths answer under /ui/ too, which is what the page produces when it asks by relative URL (#82)
a POST to /, or one of the page files asked for at its old address 404, naming where they moved

With nothing set - or "/" - every path means what it always meant.

Why it matters

A page of the user's own or a reverse proxy can hold the root, and the API of Strata needs no change: no client changes its base URL, and the dashboard - which already asks for its files and for the API by relative URL (#82) - reaches both spellings. /ui without the trailing slash moves with a 301 because a browser would otherwise resolve those relative URLs against /; a bookmark or an old link to / lands on the page the same way, which is what / answered until now. A POST to / is not moved: it is aimed at the API, and a 301 would turn it into a GET of the page.

The path is checked before the model loads: names of letters, digits, - or _ between slashes, at most 60 characters, and never one of the paths this server answers itself (/web, /v1, /fonts, /api, /metrics, /health, /api-monitor, ...). A wrong value stops the start with a message naming the flag and the key.

Tests

WebApp.test_the_whole_app_can_move_to_another_path covers both halves: at the default every path is unchanged; with /ui the page and its files answer under it, / and /ui answer 301 - read over a plain connection, since urllib follows a redirect by itself - the API answers at either spelling for GET and POST, and a POST at the root stays an error.

Measured on Linux with Python 3.12, mock engine, no GPU and no download:

  • python -m unittest serve.test_server serve.test_monitor serve.test_security -> 238 tests OK
  • python -m unittest serve.test_runconfig -> 9 OK; python tools/test_setup_choices.py -> 35 OK
  • a live server with --dashboard /ui: GET / -> HTTP/1.0 301 with Location: /ui/; GET /?q=hi -> 301 to /ui/?q=hi; curl -L / -> 200 at http://127.0.0.1:8097/ui/; POST / -> 404; GET /web/app.js -> 404; /ui/ and /v1/models -> 200. The same server without the flag: / -> 200, as before.

Docs and the rest

docs/DETAILS.md documents the key and what each path answers. serve/web/monitor.html and monitor.js move from absolute to relative paths so the monitor page works under the new path too, and sycl/serve/server_intel.py reuses the same routing, so the Arc wrapper follows the same rules. The READMEs, docs/INSTALL.md, docs/AI_SETUP.md and setup.py only spell the default address with its trailing slash.

Commits

  • a28bcd8 feat(serve): serve the web page under an optional "dashboard" path
  • 54422de fix(serve): / redirects to the dashboard path instead of answering 404

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1202 **Author:** [@gener-vscode](https://github.com/gener-vscode) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/dashboard-baseurl` --- ### 📝 Commits (4) - [`a28bcd8`](https://github.com/Niko1221/Strata/commit/a28bcd81c78a03f6341f69e33807c23efbe7c14a) feat(serve): serve the web page under an optional "dashboard" path - [`54422de`](https://github.com/Niko1221/Strata/commit/54422dea5be096eb53e604e418bd6e8a636ffa9b) fix(serve): / redirects to the dashboard path instead of answering 404 - [`0e6fe0d`](https://github.com/Niko1221/Strata/commit/0e6fe0d2f76579f063e8bc04a4ce86d1ba2fc630) feat(serve): open the page on the tab the config names - [`8937332`](https://github.com/Niko1221/Strata/commit/8937332ec544c321a3790c36d0ee9a0fc51b5fde) feat(serve): tell the page its tab, and give Chat its own address ### 📊 Changes **18 files changed** (+265 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `README.de.md` (+2 -2) 📝 `README.es.md` (+2 -2) 📝 `README.fr.md` (+2 -2) 📝 `README.ja.md` (+2 -2) 📝 `README.md` (+2 -2) 📝 `README.pt-BR.md` (+2 -2) 📝 `README.zh-CN.md` (+2 -2) 📝 `docs/AI_SETUP.md` (+2 -2) 📝 `docs/DETAILS.md` (+25 -1) 📝 `docs/INSTALL.md` (+2 -2) 📝 `serve/server.py` (+128 -8) 📝 `serve/test_monitor.py` (+1 -1) 📝 `serve/test_server.py` (+70 -1) 📝 `serve/web/app.js` (+6 -3) 📝 `serve/web/monitor.html` (+2 -2) 📝 `serve/web/monitor.js` (+3 -3) 📝 `setup.py` (+1 -1) 📝 `sycl/serve/server_intel.py` (+11 -4) </details> ### 📄 Description ### What The web page answered only at `/`, so nothing else could hold that address on the same port. A run-config key `"dashboard"` (or `serve/server.py --dashboard /ui`) now serves the page under a path of the user's choosing, together with the files the page loads for itself: | with `"dashboard": "/ui"` | answer | |---|---| | `/ui/` | the chat page (Chat / Monitor / About) | | `/ui/web/app.js`, `/ui/web/app.css`, `/ui/web/sprite.svg`, `/ui/fonts/*` | the styles, script, sprite and font the page loads itself | | `/` and `/ui`, asked with GET | `301` to `/ui/`, keeping a `?q=` that came with it (`/?q=hi` to `/ui/?q=hi`) | | `/v1/chat/completions`, `/v1/messages`, `/v1/responses`, `/health`, `/metrics`, `/status`, `/slots`, `/props`, `/models`, `/mcp`, `/load`, `/unload` | unchanged, at `/` as they always were; the same paths answer under `/ui/` too, which is what the page produces when it asks by relative URL (#82) | | a POST to `/`, or one of the page files asked for at its old address | `404`, naming where they moved | With nothing set - or `"/"` - every path means what it always meant. ### Why it matters A page of the user's own or a reverse proxy can hold the root, and the API of Strata needs no change: no client changes its base URL, and the dashboard - which already asks for its files and for the API by relative URL (#82) - reaches both spellings. `/ui` without the trailing slash moves with a 301 because a browser would otherwise resolve those relative URLs against `/`; a bookmark or an old link to `/` lands on the page the same way, which is what `/` answered until now. A POST to `/` is not moved: it is aimed at the API, and a 301 would turn it into a GET of the page. The path is checked before the model loads: names of letters, digits, `-` or `_` between slashes, at most 60 characters, and never one of the paths this server answers itself (`/web`, `/v1`, `/fonts`, `/api`, `/metrics`, `/health`, `/api-monitor`, ...). A wrong value stops the start with a message naming the flag and the key. ### Tests `WebApp.test_the_whole_app_can_move_to_another_path` covers both halves: at the default every path is unchanged; with `/ui` the page and its files answer under it, `/` and `/ui` answer `301` - read over a plain connection, since urllib follows a redirect by itself - the API answers at either spelling for GET and POST, and a POST at the root stays an error. Measured on Linux with Python 3.12, mock engine, no GPU and no download: - `python -m unittest serve.test_server serve.test_monitor serve.test_security` -> 238 tests OK - `python -m unittest serve.test_runconfig` -> 9 OK; `python tools/test_setup_choices.py` -> 35 OK - a live server with `--dashboard /ui`: `GET /` -> `HTTP/1.0 301` with `Location: /ui/`; `GET /?q=hi` -> `301` to `/ui/?q=hi`; `curl -L /` -> `200` at `http://127.0.0.1:8097/ui/`; `POST /` -> 404; `GET /web/app.js` -> 404; `/ui/` and `/v1/models` -> 200. The same server without the flag: `/` -> 200, as before. ### Docs and the rest `docs/DETAILS.md` documents the key and what each path answers. `serve/web/monitor.html` and `monitor.js` move from absolute to relative paths so the monitor page works under the new path too, and `sycl/serve/server_intel.py` reuses the same routing, so the Arc wrapper follows the same rules. The READMEs, `docs/INSTALL.md`, `docs/AI_SETUP.md` and `setup.py` only spell the default address with its trailing slash. ### Commits - `a28bcd8` feat(serve): serve the web page under an optional "dashboard" path - `54422de` fix(serve): / redirects to the dashboard path instead of answering 404 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:40:31 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3307
No description provided.