From bb31bd33c2ba3ebecd29193f3f77ccde59000a20 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Tue, 31 Mar 2026 12:26:23 -0700 Subject: [PATCH] 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 --- server/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/index.ts b/server/index.ts index 8aa2b04..b2667aa 100644 --- a/server/index.ts +++ b/server/index.ts @@ -3340,7 +3340,7 @@ const server = Bun.serve({ // 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");