/** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, // Bundle next-mdx-remote so it uses the React copy Next ships for server components transpilePackages: ['next-mdx-remote'], trailingSlash: false, skipTrailingSlashRedirect: true, async redirects() { // Host redirects (old AI Resource Pro addresses, www) live in cloudflare-worker.mjs. // The AI tutorials moved under Knowledge work > Using AI at work; old pages go home. const usingAi = '/knowledge-work/using-ai'; return [ ...['claude', 'chatgpt', 'computer-use', 'ai-video'].flatMap((track) => [ { source: `/${track}`, destination: usingAi, permanent: true }, { source: `/${track}/:slug`, destination: `${usingAi}/:slug`, permanent: true }, ]), ...['/tutorials', '/videos', '/getting-started', '/about', '/content-rights', '/pay-and-pricing', '/feed.xml', '/roadmap', '/roadmap/:path*'].map( (source) => ({ source, destination: '/', permanent: true }) ), ]; }, async headers() { const siteCsp = [ "default-src 'self'", "script-src 'self' 'unsafe-eval' 'unsafe-inline'", "style-src 'self' 'unsafe-inline'", "font-src 'self' data:", "img-src 'self' blob: data: https: http:", "media-src 'self'", "connect-src 'self' https://projectatom.ai", "frame-src 'self'", "object-src 'none'", "base-uri 'self'", "form-action 'self'", "frame-ancestors 'none'", "upgrade-insecure-requests" ]; return [ { source: '/(.*)', headers: [ { key: 'Content-Security-Policy', value: siteCsp.join('; '), }, { key: 'X-DNS-Prefetch-Control', value: 'on', }, { key: 'Strict-Transport-Security', value: 'max-age=63072000; includeSubDomains; preload', }, { key: 'X-Content-Type-Options', value: 'nosniff', }, { key: 'Referrer-Policy', value: 'origin-when-cross-origin', }, ], }, ]; }, }; export default nextConfig;