import type { NextConfig } from "next"; const env = process.env.APP_ENV || "development"; const config: NextConfig = { output: "standalone", distDir: env === "production" ? ".next" : env === "test" ? ".next-test" : ".next-dev", poweredByHeader: false, // Go serves generated files without application compression; keep file byte lengths and ranges intact. // Public reverse proxies may apply the same transport compression used for the original Go service. compress: false, htmlLimitedBots: /.*/, // Keep complete SEO metadata in the initial HTML for every crawler/client. // Preserve source canonical redirects in proxy.ts before React rendering. skipTrailingSlashRedirect: true, skipProxyUrlNormalize: true, outputFileTracingIncludes: { "/*": [ "./config/secrets/m3u8.key", "./template/pages/robots.txt", "./templates/pages/robots.txt", "./app/template/pages/robots.txt", "./app/templates/pages/robots.txt", "./config/seo/**/*", ], }, // Keep XML out of page traces. package-standalone.ts also removes copies from Node Proxy traces. outputFileTracingExcludes: { "/*": [ "./template/pages/sitemaps/**/*", "./template/pages/sitemap.xml", "./data/sitemaps/**/*", ], }, async headers() { return [ { source: "/sw.js", headers: [ { key: "Content-Type", value: "application/javascript; charset=utf-8" }, { key: "Cache-Control", value: "no-cache, no-store, must-revalidate" }, { key: "Service-Worker-Allowed", value: "/" }, ], }, { source: "/static/:path*", headers: [ { key: "Cache-Control", value: "public, max-age=604800, stale-while-revalidate=86400", }, ], }, ]; }, }; export default config;