feat(relay): BUZZ_WEB_SPA=full to serve a full client bundle - #3027
Open
flaukowski wants to merge 1 commit into
Open
feat(relay): BUZZ_WEB_SPA=full to serve a full client bundle#3027flaukowski wants to merge 1 commit into
flaukowski wants to merge 1 commit into
Conversation
The relay only falls back to the SPA shell for the invite landing page, and optionally the bundled git browser. A deployment whose BUZZ_WEB_DIR bundle is a full client has no way to get client-side routing for its own paths — each one needs a bespoke predicate compiled into should_serve_spa. Add BUZZ_WEB_SPA=full: when set, any path the relay does not serve itself falls back to index.html. Server-owned paths (/api, /git, /hooks, /media, /upload, /.well-known, /_*, /events, /query, /count, /info, /health, /moderation) keep returning their own responses, so a mistyped API call still 404s rather than returning HTML a client would try to parse. Defaults to false; behaviour with the variable unset is unchanged. Tests cover the opt-in path, the server-owned 404 list, and default-off. Signed-off-by: flaukowski <nikolaiflaukowski@gmail.com>
flaukowski
added a commit
to flaukowski/kannaka-buzz
that referenced
this pull request
Jul 26, 2026
Keeps fork main byte-identical to the upstream branch in block#3027, so the two do not drift while the PR is in review. Signed-off-by: flaukowski <nikolaiflaukowski@gmail.com>
This was referenced Jul 27, 2026
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
should_serve_spaonly falls back to the SPA shell for the invite landing page, and optionally the bundled git browser:A deployment that points
BUZZ_WEB_DIRat a full client bundle has no way to get client-side routing for its own paths — every route needs a bespoke predicate compiled into the router. Any client-side route reached by deep link or refresh 404s.Change
Add
BUZZ_WEB_SPA=full. When set, any path the relay does not serve itself falls back toindex.html.Server-owned paths still return their own responses, so a mistyped API call 404s instead of returning HTML that a client would then try to parse as JSON:
/api/…,/git/…,/hooks/…,/media/…,/upload,/.well-known/…,/_*,/events,/query,/count,/info,/health,/moderationDefaults to false. With the variable unset, behaviour is unchanged.
Tests
Three new cases in
crates/buzz-relay/src/router.rs:full_spa_mode_serves_arbitrary_client_routes— opt-in serves paths the relay has never heard offull_spa_mode_still_lets_server_paths_404— every server-owned prefix must not fall backfull_spa_mode_is_off_by_default— unknown paths still 404 without the opt-inPlus a default-value assertion in the config tests, and a
TESTING.mdrow for the new variable.Context
We run a self-hosted Buzz deployment whose web bundle is a full workspace client. We had been carrying a hardcoded path predicate in
should_serve_spato make it work; this generalises that into an opt-in flag so the fix isn't per-route, and lets us drop the local patch.🤖 Generated with Claude Code