Skip to content

Scheduling infrastructure for absolutely everyone.

chore: redirect to /500 if pathname does not exist + better error handling (#18615)

Benny Joob3ed6e39e341
diff --git a/apps/web/app/not-found.tsx b/apps/web/app/not-found.tsx
index 46251b99843..a03b61b3403 100644
--- a/apps/web/app/not-found.tsx
+++ b/apps/web/app/not-found.tsx
@@ -2,6 +2,7 @@ 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,
@@ -52,6 +53,10 @@ async function NotFound() {
const host = headersList.get("x-forwarded-host") ?? "";
const pathname = headersList.get("x-pathname") ?? "";
+ if (!pathname) {
+ redirect("/500");
+ }
+
const { username, pageType, url } = getPageInfo(pathname, host);
const isBookingSuccessPage = pathname?.startsWith("/booking");
const isSubpage = pathname?.includes("/", 2) || isBookingSuccessPage;
diff --git a/apps/web/components/error/error-page.tsx b/apps/web/components/error/error-page.tsx
index 0990a2aac48..b70086ca853 100644
--- a/apps/web/components/error/error-page.tsx
+++ b/apps/web/components/error/error-page.tsx
@@ -61,7 +61,7 @@ export const ErrorPage: React.FC<Props> = (props) => {
<h1 className="font-cal text-emphasis text-6xl">{statusCode}</h1>
<h2 className="text-emphasis mt-6 max-w-2xl text-2xl font-medium">It's not you, it's us.</h2>
<p className="text-default mb-6 mt-4 max-w-2xl text-sm">
- Something went wrong on our end. Get in touch with our support team, and we’ll get it fixed right
+ Something went wrong on our end. Get in touch with our support team, and we'll get it fixed right
away for you.
</p>
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index cd9843a5d19..2cde8766fda 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -177,17 +177,15 @@ export const config = {
"/event-types/:path*",
"/workflows/:path*",
"/getting-started/:path*",
- "/auth/login",
- "/future/auth/login",
"/workflows/:path*",
"/getting-started/:path*",
"/event-types/:path*",
"/apps/:path*",
"/routing/:path*",
- "/bookings/:status/",
+ "/bookings/:path*",
"/video/:path*",
- "/teams",
- "/signup",
+ "/teams/:path*",
+ "/signup/:path*",
"/settings/:path*",
"/reschedule/:path*",
"/availability/:path*",