fix(routing): prevent /modules/ path from being redirected as a space slug

The subdomain canonicalization logic treated "modules" as a space slug,
redirecting /modules/rmeets/... to modules.rspace.online/rmeets/... (503).
Add "modules" to the serverPaths exclusion set so module JS assets
served from /modules/ are handled by Hono instead of redirected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-31 12:26:23 -07:00
parent 0a6dcef4b9
commit bb31bd33c2
1 changed files with 1 additions and 1 deletions

View File

@ -3340,7 +3340,7 @@ const server = Bun.serve<WSData>({
// rspace.online/{space}/{...} → handle space-prefixed paths
// (space is not a module ID — it's a space slug)
// Skip for known server paths (api, admin, etc.)
const serverPaths = new Set(["api", "admin", "admin-data", "admin-action", ".well-known"]);
const serverPaths = new Set(["api", "admin", "admin-data", "admin-action", "modules", ".well-known"]);
if (!knownModuleIds.has(firstSegment) && !serverPaths.has(firstSegment) && pathSegments.length >= 2) {
const secondSeg = pathSegments[1]?.toLowerCase();
const isApiCall = secondSeg === "api" || pathSegments.some((s, i) => i >= 1 && s === "api");