Skip to content

Scheduling infrastructure for absolutely everyone.

perf: Move runtime redirects to build-time redirects in next.config.js (#23325)

Benny Joo2922c8fe7777
diff --git a/apps/web/app/(use-page-wrapper)/apps/installed/page.tsx b/apps/web/app/(use-page-wrapper)/apps/installed/page.tsx
deleted file mode 100644
index c602a66bd77..00000000000
--- a/apps/web/app/(use-page-wrapper)/apps/installed/page.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import { redirect } from "next/navigation";
-
-const Page = () => {
- redirect("/apps/installed/calendar");
-};
-
-export default Page;
diff --git a/apps/web/app/(use-page-wrapper)/apps/routing-forms/page.tsx b/apps/web/app/(use-page-wrapper)/apps/routing-forms/page.tsx
deleted file mode 100644
index 06a1a03d538..00000000000
--- a/apps/web/app/(use-page-wrapper)/apps/routing-forms/page.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import { redirect } from "next/navigation";
-
-const ServerPage = async () => {
- redirect("/apps/routing-forms/forms");
-};
-
-export default ServerPage;
diff --git a/apps/web/app/(use-page-wrapper)/settings/(admin-layout)/admin/apps/page.tsx b/apps/web/app/(use-page-wrapper)/settings/(admin-layout)/admin/apps/page.tsx
deleted file mode 100644
index f0e91e15d65..00000000000
--- a/apps/web/app/(use-page-wrapper)/settings/(admin-layout)/admin/apps/page.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { _generateMetadata } from "app/_utils";
-import { redirect } from "next/navigation";
-
-export const generateMetadata = async () =>
- await _generateMetadata(
- (t) => t("apps"),
- (t) => t("admin_apps_description"),
- undefined,
- undefined,
- "/settings/admin/apps"
- );
-
-const Page = () => {
- redirect("/settings/admin/apps/calendar");
-};
-
-export default Page;
diff --git a/apps/web/app/auth/new/page.tsx b/apps/web/app/auth/new/page.tsx
deleted file mode 100644
index 87df23a99f8..00000000000
--- a/apps/web/app/auth/new/page.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import { redirect } from "next/navigation";
-
-export default function Page() {
- redirect(process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com");
-}
diff --git a/apps/web/app/routing-forms/page.tsx b/apps/web/app/routing-forms/page.tsx
deleted file mode 100644
index ba222ba4761..00000000000
--- a/apps/web/app/routing-forms/page.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import { redirect } from "next/navigation";
-
-const Page = () => {
- redirect("/apps/routing-forms/forms");
-};
-
-export default Page;
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index bbc93995ba2..4f8c665613d 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -295,6 +295,10 @@ const nextConfig = (phase) => {
source: "/routing/:path*",
destination: "/apps/routing-forms/:path*",
},
+ {
+ source: "/routing-forms",
+ destination: "/apps/routing-forms/forms",
+ },
{
source: "/success/:path*",
has: [
@@ -548,7 +552,7 @@ const nextConfig = (phase) => {
},
{
source: "/apps/routing-forms",
- destination: "/routing/forms",
+ destination: "/apps/routing-forms/forms",
permanent: false,
},
{
@@ -556,6 +560,11 @@ const nextConfig = (phase) => {
destination: "/app-store/:path*",
permanent: true,
},
+ {
+ source: "/auth/new",
+ destination: process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com",
+ permanent: true,
+ },
{
source: "/auth/signup",
destination: "/signup",
@@ -653,6 +662,11 @@ const nextConfig = (phase) => {
destination: "/settings/platform",
permanent: true,
},
+ {
+ source: "/settings/admin/apps",
+ destination: "/settings/admin/apps/calendar",
+ permanent: true,
+ },
// OAuth callbacks when sent to localhost:3000(w would be expected) should be redirected to corresponding to WEBAPP_URL
...(process.env.NODE_ENV === "development" &&
// Safer to enable the redirect only when the user is opting to test out organizations