Branchwell

Become a Pro / website · becomeapro.ai / next.config.js

Raw 2.2 KB on 8e2ed58faade31e8c0f006487134af60b0720a7d
1/** @type {import('next').NextConfig} */
2
3const nextConfig = {
4 reactStrictMode: true,
5 // Bundle next-mdx-remote so it uses the React copy Next ships for server components
6 transpilePackages: ['next-mdx-remote'],
7 trailingSlash: false,
8 skipTrailingSlashRedirect: true,
9 async redirects() {
10 // Host redirects (old AI Resource Pro addresses, www) live in cloudflare-worker.mjs.
11 // The AI tutorials moved under Knowledge work > Using AI at work; old pages go home.
12 const usingAi = '/knowledge-work/using-ai';
13 return [
14 ...['claude', 'chatgpt', 'computer-use', 'ai-video'].flatMap((track) => [
15 { source: `/${track}`, destination: usingAi, permanent: true },
16 { source: `/${track}/:slug`, destination: `${usingAi}/:slug`, permanent: true },
17 ]),
18 ...['/tutorials', '/videos', '/getting-started', '/about', '/content-rights', '/pay-and-pricing', '/feed.xml', '/roadmap', '/roadmap/:path*'].map(
19 (source) => ({ source, destination: '/', permanent: true })
20 ),
21 ];
22 },
23 async headers() {
24 const siteCsp = [
25 "default-src 'self'",
26 "script-src 'self' 'unsafe-eval' 'unsafe-inline'",
27 "style-src 'self' 'unsafe-inline'",
28 "font-src 'self' data:",
29 "img-src 'self' blob: data: https: http:",
30 "media-src 'self'",
31 "connect-src 'self' https://projectatom.ai",
32 "frame-src 'self'",
33 "object-src 'none'",
34 "base-uri 'self'",
35 "form-action 'self'",
36 "frame-ancestors 'none'",
37 "upgrade-insecure-requests"
38 ];
39 return [
40 {
41 source: '/(.*)',
42 headers: [
43 {
44 key: 'Content-Security-Policy',
45 value: siteCsp.join('; '),
46 },
47 {
48 key: 'X-DNS-Prefetch-Control',
49 value: 'on',
50 },
51 {
52 key: 'Strict-Transport-Security',
53 value: 'max-age=63072000; includeSubDomains; preload',
54 },
55 {
56 key: 'X-Content-Type-Options',
57 value: 'nosniff',
58 },
59 {
60 key: 'Referrer-Policy',
61 value: 'origin-when-cross-origin',
62 },
63 ],
64 },
65 ];
66 },
67};
68
69export default nextConfig;