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:
1 parent
e07b1eda32
commit
b3ed6e39e3
3 files changed
+9
-6
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user