Claude/monitoring dashboard worker tt4 x7#88
Merged
Conversation
Adds path-prefix support so the dashboard can be served at
``/monitor/`` on the same host as the main API, with no separate TLS
cert. Local docker compose keeps working unchanged because the new
``MONITOR_ROOT_PATH`` env var defaults to empty.
Mechanics:
* ``MONITOR_ROOT_PATH=/monitor`` (set by the ingress deployment) is
passed to ``FastAPI(root_path=...)`` and ``uvicorn.run(root_path=...)``
so self-referential URLs (OpenAPI, redirects) point at the public
prefix.
* The two HTML pages are now templated: ``index()`` and
``history_page()`` substitute ``{{BASE_HREF}}`` into a cached read,
emitting ``<base href="/monitor/">`` in production or ``<base
href="/">`` locally. All other URLs in the HTML and JS were
switched from absolute (``/static/style.css``, ``/api/snapshot``,
``/ws``) to relative (``static/style.css``, ``api/snapshot``), so
the browser resolves them against ``document.baseURI``.
* The websocket URL is built from ``document.baseURI`` -- protocol
flipped to ``ws``/``wss``, path becomes ``${baseURI.pathname}ws`` --
so ``/monitor/ws`` resolves correctly under a prefix.
The ingress must still strip the prefix before forwarding (e.g. nginx
``rewrite-target: /$2`` with a ``/monitor(/|$)(.*)`` path). The app
sees unprefixed routes; the browser uses ``<base>`` to construct
prefixed URLs for fetches, links, and the socket.
Codecov Report❌ Patch coverage is
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
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.
No description provided.