Lumen & Gesso / website · lumengesso.com / next.config.mjs
| 1 | import path from 'node:path'; |
| 2 | import { fileURLToPath } from 'node:url'; |
| 3 | import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare'; |
| 4 | |
| 5 | initOpenNextCloudflareForDev(); |
| 6 | |
| 7 | const __dirname = path.dirname(fileURLToPath(import.meta.url)); |
| 8 | |
| 9 | /** @type {import('next').NextConfig} */ |
| 10 | const nextConfig = { |
| 11 | // Pin the workspace root to this project so Next.js doesn't bind to a |
| 12 | // parent lockfile when one happens to exist further up the tree. |
| 13 | outputFileTracingRoot: __dirname, |
| 14 | // Portrait + site imagery is served from Cloudflare Images (see |
| 15 | // app/lib/cf-images.ts and scripts/upload-portraits-to-cf.mjs); the |
| 16 | // binaries no longer live in public/portraits. Allow next/image to |
| 17 | // optimize the remote CDN source. |
| 18 | images: { |
| 19 | remotePatterns: [ |
| 20 | { protocol: 'https', hostname: 'imagedelivery.net' }, |
| 21 | ], |
| 22 | }, |
| 23 | // Allow the persistent ngrok tunnel (used for Stripe webhook testing |
| 24 | // and any other off-localhost preview) to load the dev server. Next |
| 25 | // 15.5+ rejects cross-origin dev requests with a "blocked cross-origin" |
| 26 | // error unless the host is explicitly allowlisted here. |
| 27 | allowedDevOrigins: ['lumengesso.ngrok.app'], |
| 28 | // One canonical host for search engines: www.lumengesso.com 301s to |
| 29 | // lumengesso.com (the canonical tags, sitemap and Search Console and |
| 30 | // Bing properties all use the bare domain). /api/ is left alone so |
| 31 | // webhooks (Stripe, Prodigi) or OAuth callbacks registered on www keep |
| 32 | // working: a 301 would turn their POSTs into GETs. |
| 33 | async redirects() { |
| 34 | return [ |
| 35 | { source: '/pay-and-pricing', destination: '/', permanent: true }, |
| 36 | { |
| 37 | source: '/:path((?!api/).*)', |
| 38 | has: [{ type: 'host', value: 'www.lumengesso.com' }], |
| 39 | destination: 'https://lumengesso.com/:path*', |
| 40 | permanent: true, |
| 41 | }, |
| 42 | ]; |
| 43 | }, |
| 44 | }; |
| 45 | |
| 46 | export default nextConfig; |