import type { NextConfig } from "next"; import path from "node:path"; import { fileURLToPath } from "node:url"; const root = path.dirname(fileURLToPath(import.meta.url)); const workspaceRoot = path.resolve(root, "../.."); const securityHeaders = [ { key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload", }, { 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=(), interest-cohort=()", }, ]; const nextConfig: NextConfig = { output: "standalone", turbopack: { root: workspaceRoot, }, async rewrites() { const target = process.env.LANDING_API_PROXY_TARGET ?? (process.env.NODE_ENV === "production" ? "http://backend-api:8000" : "http://127.0.0.1:8000"); return [ { source: "/api/:path*", destination: `${target}/api/:path*`, }, ]; }, async headers() { return [ { source: "/:path*", headers: securityHeaders, }, ]; }, }; export default nextConfig;