import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare'; initOpenNextCloudflareForDev(); const __dirname = path.dirname(fileURLToPath(import.meta.url)); /** @type {import('next').NextConfig} */ const nextConfig = { // Pin the workspace root to this project so Next.js doesn't bind to a // parent lockfile when one happens to exist further up the tree. outputFileTracingRoot: __dirname, // Portrait + site imagery is served from Cloudflare Images (see // app/lib/cf-images.ts and scripts/upload-portraits-to-cf.mjs); the // binaries no longer live in public/portraits. Allow next/image to // optimize the remote CDN source. images: { remotePatterns: [ { protocol: 'https', hostname: 'imagedelivery.net' }, ], }, // Allow the persistent ngrok tunnel (used for Stripe webhook testing // and any other off-localhost preview) to load the dev server. Next // 15.5+ rejects cross-origin dev requests with a "blocked cross-origin" // error unless the host is explicitly allowlisted here. allowedDevOrigins: ['lumengesso.ngrok.app'], // One canonical host for search engines: www.lumengesso.com 301s to // lumengesso.com (the canonical tags, sitemap and Search Console and // Bing properties all use the bare domain). /api/ is left alone so // webhooks (Stripe, Prodigi) or OAuth callbacks registered on www keep // working: a 301 would turn their POSTs into GETs. async redirects() { return [ { source: '/pay-and-pricing', destination: '/', permanent: true }, { source: '/:path((?!api/).*)', has: [{ type: 'host', value: 'www.lumengesso.com' }], destination: 'https://lumengesso.com/:path*', permanent: true, }, ]; }, }; export default nextConfig;