Skip to content

Commit 733c1e6

Browse files
committed
[TOOL-3483] Dashboard: Fix Nebula subdomain rewrite for Vercel preview links (#6303)
<!-- start pr-codex --> ## PR-Codex overview This PR updates the middleware logic to handle subdomains more flexibly, accommodating both the standard `nebula` subdomain and a new format used in Vercel previews. ### Detailed summary - Changed the condition to check for `subdomain` being either `nebula` or starting with `nebula---`. - Updated the path rewriting logic to prepend `nebula-app` to the existing paths when the condition is met. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 439485b commit 733c1e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/dashboard/src/middleware.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export async function middleware(request: NextRequest) {
3333
const paths = pathname.slice(1).split("/");
3434

3535
// nebula.thirdweb.com -> render page at app/nebula-app
36-
if (subdomain === "nebula" && host) {
36+
// on vercel preview, the format is nebula---thirdweb-www-git-<branch-name>.thirdweb-preview.com
37+
if (
38+
subdomain &&
39+
(subdomain === "nebula" || subdomain.startsWith("nebula---"))
40+
) {
3741
const newPaths = ["nebula-app", ...paths];
3842
return rewrite(request, `/${newPaths.join("/")}`, undefined);
3943
}

0 commit comments

Comments
 (0)