Skip to content

Commit a51cd21

Browse files
committed
fix(core): skip BC route resolution for 404 path
1 parent 06fd9aa commit a51cd21

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

core/middlewares/with-routes.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ export const withRoutes: MiddlewareFactory = () => {
292292

293293
const { route, status } = await getRouteInfo(request, event);
294294

295+
console.log('status', status);
296+
console.log('route', route);
297+
295298
if (status === 'MAINTENANCE') {
296299
// 503 status code not working - https://github.com/vercel/next.js/issues/50155
297300
return NextResponse.rewrite(new URL(`/${locale}/maintenance`, request.url), { status: 503 });
@@ -355,6 +358,8 @@ export const withRoutes: MiddlewareFactory = () => {
355358
const node = route?.node;
356359
let url: string;
357360

361+
console.log('node', node);
362+
358363
switch (node?.__typename) {
359364
case 'Brand': {
360365
url = `/${locale}/brand/${node.entityId}`;
@@ -413,6 +418,8 @@ export const withRoutes: MiddlewareFactory = () => {
413418

414419
const rewriteUrl = new URL(url, request.url);
415420

421+
console.log('rewriteUrl', rewriteUrl);
422+
416423
rewriteUrl.search = request.nextUrl.search;
417424

418425
return NextResponse.rewrite(rewriteUrl);

0 commit comments

Comments
 (0)