import type { NextConfig } from "next"; const apiUrl = (process.env.API_URL ?? "http://127.0.0.1:8231").replace(/\/$/, ""); const nextConfig: NextConfig = { reactStrictMode: true, agentRules: false, poweredByHeader: false, transpilePackages: ["@spinza/shared", "@spinza/game-core", "@spinza/games"], async rewrites() { // The whole /api namespace is served by the Fastify service on the loopback interface. return [{ source: "/api/:path*", destination: `${apiUrl}/api/:path*` }]; }, async redirects() { return [{ source: "/:path*", has: [{ type: "host", value: "spinza.dev" }], destination: "https://www.spinza.dev/:path*", permanent: true }]; }, async headers() { return [ { source: "/(.*)", headers: [ { key: "X-Content-Type-Options", value: "nosniff" }, { key: "X-Frame-Options", value: "DENY" }, { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" }, { key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=(), payment=()" }, ], }, ]; }, }; export default nextConfig;