Branchwell

AI Resource Pro / website / next.config.js

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 // One canonical host: www.airesourcepro.com and the old airesource.pro domains all go to airesourcepro.com
11 return [
12 {
13 source: '/:path*',
14 has: [{ type: 'host', value: 'www.airesourcepro.com' }],
15 destination: 'https://airesourcepro.com/:path*',
16 permanent: true,
17 },
18 {
19 source: '/:path*',
20 has: [{ type: 'host', value: 'airesource.pro' }],
21 destination: 'https://airesourcepro.com/:path*',
22 permanent: true,
23 },
24 {
25 source: '/:path*',
26 has: [{ type: 'host', value: 'www.airesource.pro' }],
27 destination: 'https://airesourcepro.com/:path*',
28 permanent: true,
29 },
30 { source: '/pay-and-pricing', destination: '/', permanent: true },
31 ];
32 },
33 images: {
34 // One quality for every next/image, so covers and video thumbnails aren't re-encoded at the
35 // default 75, which turns the dark gradients blocky and smears small particles and text
36 qualities: [90],
37 remotePatterns: [
38 { protocol: 'https', hostname: 'lh3.googleusercontent.com' },
39 { protocol: 'https', hostname: 'airesourcepro.com', pathname: '/media/**' },
40 ],
41 },
42 async headers() {
43 const siteCsp = [
44 "default-src 'self'",
45 "script-src 'self' 'unsafe-eval' 'unsafe-inline' https://appleid.apple.com",
46 "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
47 "font-src 'self' https://fonts.gstatic.com https://appleid.cdn-apple.com data:",
48 "img-src 'self' blob: data: https: http:",
49 "media-src 'self'",
50 "connect-src 'self' https://appleid.apple.com https://projectatom.ai",
51 "frame-src 'self' https://appleid.apple.com",
52 "object-src 'none'",
53 "base-uri 'self'",
54 "form-action 'self'",
55 "frame-ancestors 'none'",
56 "upgrade-insecure-requests"
57 ];
58 const loginCsp = siteCsp.map((rule) => {
59 if (rule.startsWith("script-src")) return rule + " https://accounts.google.com/gsi/client https://appleid.cdn-apple.com";
60 if (rule.startsWith("style-src")) return rule + " https://accounts.google.com/gsi/style";
61 if (rule.startsWith("connect-src") || rule.startsWith("frame-src")) return rule + " https://accounts.google.com/gsi/";
62 return rule;
63 });
64 return [
65 {
66 source: '/(.*)',
67 headers: [
68 {
69 key: 'Content-Security-Policy',
70 value: siteCsp.join('; '),
71 },
72 {
73 key: 'X-DNS-Prefetch-Control',
74 value: 'on',
75 },
76 {
77 key: 'Strict-Transport-Security',
78 value: 'max-age=63072000; includeSubDomains; preload',
79 },
80 {
81 key: 'X-Content-Type-Options',
82 value: 'nosniff',
83 },
84 {
85 key: 'Referrer-Policy',
86 value: 'origin-when-cross-origin',
87 },
88 ],
89 },
90 {
91 source: '/login',
92 headers: [
93 { key: 'Content-Security-Policy', value: loginCsp.join('; ') },
94 { key: 'Cross-Origin-Opener-Policy', value: 'same-origin-allow-popups' },
95 ],
96 },
97 ];
98 },
99};
100
101export default nextConfig;