Scheduling infrastructure for absolutely everyone.
chore: early return for next.js static assets (#19678)
Benny Jooefd427831d27
diff --git a/apps/web/middleware.ts b/apps/web/middleware.tsindex 8d6d69f8f2a..b7d5faf0972 100644--- a/apps/web/middleware.ts+++ b/apps/web/middleware.ts@@ -39,10 +39,21 @@ export function checkPostMethod(req: NextRequest) {return null;}+export function checkStaticFiles(pathname: string) {+ const hasFileExtension = /\.(svg|png|jpg|jpeg|gif|webp|ico)$/.test(pathname);+ // Skip Next.js internal paths (_next) and static assets+ if (pathname.startsWith("/_next") || hasFileExtension) {+ return NextResponse.next();+ }+}+const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {const postCheckResult = checkPostMethod(req);if (postCheckResult) return postCheckResult;+ const isStaticFile = checkStaticFiles(req.nextUrl.pathname);+ if (isStaticFile) return isStaticFile;+const url = req.nextUrl;const requestHeaders = new Headers(req.headers);requestHeaders.set("x-url", req.url);