chore: redirect to /500 if pathname does not exist + better error handling (#18615)
* fix lint error * fix booking page and better error handling
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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*",
|
||||
|
||||
Reference in New Issue
Block a user