/** @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() { // One canonical host: www.airesourcepro.com and the old airesource.pro domains all go to airesourcepro.com return [ { source: '/:path*', has: [{ type: 'host', value: 'www.airesourcepro.com' }], destination: 'https://airesourcepro.com/:path*', permanent: true, }, { source: '/:path*', has: [{ type: 'host', value: 'airesource.pro' }], destination: 'https://airesourcepro.com/:path*', permanent: true, }, { source: '/:path*', has: [{ type: 'host', value: 'www.airesource.pro' }], destination: 'https://airesourcepro.com/:path*', permanent: true, }, { source: '/pay-and-pricing', destination: '/', permanent: true }, ]; }, images: { // One quality for every next/image, so covers and video thumbnails aren't re-encoded at the // default 75, which turns the dark gradients blocky and smears small particles and text qualities: [90], remotePatterns: [ { protocol: 'https', hostname: 'lh3.googleusercontent.com' }, { protocol: 'https', hostname: 'airesourcepro.com', pathname: '/media/**' }, ], }, async headers() { const siteCsp = [ "default-src 'self'", "script-src 'self' 'unsafe-eval' 'unsafe-inline' https://appleid.apple.com", "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com", "font-src 'self' https://fonts.gstatic.com https://appleid.cdn-apple.com data:", "img-src 'self' blob: data: https: http:", "media-src 'self'", "connect-src 'self' https://appleid.apple.com https://projectatom.ai", "frame-src 'self' https://appleid.apple.com", "object-src 'none'", "base-uri 'self'", "form-action 'self'", "frame-ancestors 'none'", "upgrade-insecure-requests" ]; const loginCsp = siteCsp.map((rule) => { if (rule.startsWith("script-src")) return rule + " https://accounts.google.com/gsi/client https://appleid.cdn-apple.com"; if (rule.startsWith("style-src")) return rule + " https://accounts.google.com/gsi/style"; if (rule.startsWith("connect-src") || rule.startsWith("frame-src")) return rule + " https://accounts.google.com/gsi/"; return rule; }); 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', }, ], }, { source: '/login', headers: [ { key: 'Content-Security-Policy', value: loginCsp.join('; ') }, { key: 'Cross-Origin-Opener-Policy', value: 'same-origin-allow-popups' }, ], }, ]; }, }; export default nextConfig;