import type { NextConfig } from "next"; const nextConfig: NextConfig = { output: "standalone", poweredByHeader: false, compress: true, images: { formats: ["image/avif", "image/webp"], minimumCacheTTL: 60 * 60 * 24 * 30, // 30 days }, async headers() { return [ { source: "/(.*)", headers: [ { key: "X-Frame-Options", value: "SAMEORIGIN" }, { key: "X-Content-Type-Options", value: "nosniff" }, { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" }, { key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()", }, { key: "X-DNS-Prefetch-Control", value: "on" }, ], }, { // Long cache for static images served from /public/images. source: "/images/(.*)", headers: [ { key: "Cache-Control", value: "public, max-age=31536000, immutable", }, ], }, ]; }, async redirects() { return [ // Force apex hostname. The www host should be terminated upstream // (Nginx Proxy Manager) and pointed at this app, OR redirected at the // proxy. This Next-side redirect is a belt-and-braces fallback so that // www → apex still happens if traffic reaches the app on the wrong host. { source: "/:path*", has: [{ type: "host", value: "www.wilddragon.net" }], destination: "https://wilddragon.net/:path*", permanent: true, }, ]; }, }; export default nextConfig;