forked from StreamFi-x/streamfi-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.ts
More file actions
18 lines (14 loc) · 619 Bytes
/
proxy.ts
File metadata and controls
18 lines (14 loc) · 619 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
export function proxy(request: NextRequest) {
const hostname = request.headers.get("host") ?? "";
// On the admin subdomain, redirect root to /admin so the user lands on
// the admin panel without having to type /admin in the URL.
if (hostname === "admin.streamfi.media" && request.nextUrl.pathname === "/") {
return NextResponse.redirect(new URL("/admin", request.url));
}
return NextResponse.next();
}
export const config = {
matcher: ["/", "/settings/:path*", "/dashboard/:path*", "/admin/:path*"],
};