Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix root 404

Steven Tey217c6f9603ad
diff --git a/apps/web/lib/middleware/admin.ts b/apps/web/lib/middleware/admin.ts
index 5336f416a9..ffa8187f04 100644
--- a/apps/web/lib/middleware/admin.ts
+++ b/apps/web/lib/middleware/admin.ts
@@ -34,5 +34,7 @@ export default async function AdminMiddleware(req: NextRequest) {
return NextResponse.redirect(new URL(`/login`, req.url));
}
- return NextResponse.rewrite(new URL(`/admin.dub.co${path}`, req.url));
+ return NextResponse.rewrite(
+ new URL(`/admin.dub.co${path === "/" ? "" : path}`, req.url),
+ );
}
diff --git a/apps/web/lib/middleware/app.ts b/apps/web/lib/middleware/app.ts
index b3499876a3..ca2a0625ea 100644
--- a/apps/web/lib/middleware/app.ts
+++ b/apps/web/lib/middleware/app.ts
@@ -79,5 +79,7 @@ export default async function AppMiddleware(req: NextRequest) {
}
// otherwise, rewrite the path to /app
- return NextResponse.rewrite(new URL(`/app.dub.co${path}`, req.url));
+ return NextResponse.rewrite(
+ new URL(`/app.dub.co${path === "/" ? "" : path}`, req.url),
+ );
}