From 07085b9ffb48ffff6ba5e50e7f1f32e93befba7b Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 14 Jan 2025 05:24:36 -0500 Subject: [PATCH] chore: clean up config.matcher in middleware (#18638) Co-authored-by: Alex van Andel --- apps/web/app/not-found.tsx | 8 ++++---- apps/web/middleware.ts | 12 +----------- apps/web/pages/_error.tsx | 2 -- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/apps/web/app/not-found.tsx b/apps/web/app/not-found.tsx index a03b61b340..95a9a8c97e 100644 --- a/apps/web/app/not-found.tsx +++ b/apps/web/app/not-found.tsx @@ -2,7 +2,6 @@ import { _generateMetadata, getTranslate } from "app/_utils"; import { WithLayout } from "app/layoutHOC"; import { headers } from "next/headers"; import Link from "next/link"; -import { redirect } from "next/navigation"; import { getOrgDomainConfigFromHostname, @@ -53,9 +52,10 @@ async function NotFound() { const host = headersList.get("x-forwarded-host") ?? ""; const pathname = headersList.get("x-pathname") ?? ""; - if (!pathname) { - redirect("/500"); - } + // This makes more sense after full migration to App Router + // if (!pathname) { + // redirect("/500"); + // } const { username, pageType, url } = getPageInfo(pathname, host); const isBookingSuccessPage = pathname?.startsWith("/booking"); diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index d1d6c3b3fe..44d95ab66b 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -171,15 +171,11 @@ export const config = { "/api/auth/signup", "/api/trpc/:path*", "/login", - "/auth/:path*", + "/auth/login", "/apps/:path*", - "/event-types/:path*", - "/workflows/:path*", "/getting-started/:path*", "/workflows/:path*", - "/getting-started/:path*", "/event-types/:path*", - "/apps/:path*", "/routing/:path*", "/bookings/:path*", "/video/:path*", @@ -189,13 +185,7 @@ export const config = { "/reschedule/:path*", "/availability/:path*", "/booking/:path*", - "/payment/:path*", - "/router/:path*", "/routing-forms/:path*", - "/org/:path*", - "/team/:path*", - "/:user/:type/", - "/:user/", ], }; diff --git a/apps/web/pages/_error.tsx b/apps/web/pages/_error.tsx index 76089811d6..50dce26a41 100644 --- a/apps/web/pages/_error.tsx +++ b/apps/web/pages/_error.tsx @@ -85,8 +85,6 @@ CustomError.getInitialProps = async (ctx: AugmentedNextPageContext) => { log.debug(`server side logged this: ${err?.toString() ?? JSON.stringify(err)}`); log.info("return props, ", errorInitialProps); - res.setHeader("x-pages-router-error", "true"); - return errorInitialProps; } else { // Running on the client (browser).