mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-13 04:45:19 +00:00
remove unused middleware file
This commit is contained in:
parent
ff350566b0
commit
47b3e1a940
1 changed files with 0 additions and 34 deletions
|
|
@ -1,34 +0,0 @@
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function middleware(request: NextRequest) {
|
||||
const host = request.headers.get("host")!;
|
||||
|
||||
const searchParams = request.nextUrl.searchParams.toString();
|
||||
const path = `${request.nextUrl.pathname}${
|
||||
searchParams.length > 0 ? `?${searchParams}` : ""
|
||||
}`;
|
||||
|
||||
if (
|
||||
host === process.env.NEXT_PUBLIC_ROOT_DOMAIN ||
|
||||
host === 'localhost:3000'
|
||||
) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
const subdomain = host.split(".")[0];
|
||||
return NextResponse.rewrite(new URL(`/${subdomain}${path}`, request.url));
|
||||
};
|
||||
|
||||
|
||||
export const config = {
|
||||
// https://nextjs.org/docs/app/building-your-application/routing/middleware#matcher
|
||||
matcher: [
|
||||
/**
|
||||
* Match all paths except for:
|
||||
* 1. /api routes
|
||||
* 2. _next/ routes
|
||||
* 3. ingest (PostHog route)
|
||||
*/
|
||||
'/((?!api|_next/static|ingest|_next/image|favicon.ico|sitemap.xml|robots.txt).*)'
|
||||
],
|
||||
}
|
||||
Loading…
Reference in a new issue