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

* routing forms

* auth new

* settings route

* apps installed

* next.config.js
This commit is contained in:
Benny Joo
2025-08-26 20:20:12 +09:00
committed by GitHub
parent 4599740637
commit 2922c8fe77
6 changed files with 15 additions and 44 deletions
@@ -1,7 +0,0 @@
import { redirect } from "next/navigation";
const Page = () => {
redirect("/apps/installed/calendar");
};
export default Page;
@@ -1,7 +0,0 @@
import { redirect } from "next/navigation";
const ServerPage = async () => {
redirect("/apps/routing-forms/forms");
};
export default ServerPage;
@@ -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;
-5
View File
@@ -1,5 +0,0 @@
import { redirect } from "next/navigation";
export default function Page() {
redirect(process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com");
}
-7
View File
@@ -1,7 +0,0 @@
import { redirect } from "next/navigation";
const Page = () => {
redirect("/apps/routing-forms/forms");
};
export default Page;
+15 -1
View File
@@ -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