-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
35 lines (31 loc) · 814 Bytes
/
Copy pathnext.config.mjs
File metadata and controls
35 lines (31 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const CANONICAL_SITE_URL = "https://judgmentkit.ai";
const LEGACY_REDIRECT_HOSTS = [
"judgmentkit.com",
"www.judgmentkit.com",
"judgmentkit.design",
"www.judgmentkit.design",
];
function normalizeSiteUrl(value) {
return new URL(/^https?:\/\//i.test(value) ? value : `https://${value}`).origin;
}
const redirectTargetUrl = normalizeSiteUrl(
process.env.JUDGMENTKIT_SITE_URL || CANONICAL_SITE_URL,
);
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ["ts", "tsx"],
async redirects() {
return LEGACY_REDIRECT_HOSTS.map((host) => ({
source: "/:path*",
has: [
{
type: "host",
value: host,
},
],
destination: `${redirectTargetUrl}/:path*`,
permanent: true,
}));
},
};
export default nextConfig;