/** @type {import('next').NextConfig} */ const BACKEND_INTERNAL_URL = process.env.BACKEND_INTERNAL_URL || "http://localhost:20001"; const nextConfig = { reactStrictMode: true, output: "standalone", images: { remotePatterns: [{ protocol: "http", hostname: "**" }, { protocol: "https", hostname: "**" }] }, async headers() { return [ { /* sw.js และ version.json ต้องไม่ถูก HTTP cache — ไม่งั้นผู้ใช้ค้างรุ่นเก่า */ source: "/sw.js", headers: [ { key: "Cache-Control", value: "no-cache, no-store, must-revalidate" }, { key: "Service-Worker-Allowed", value: "/" }, ], }, { source: "/version.json", headers: [{ key: "Cache-Control", value: "no-cache, no-store, must-revalidate" }], }, { source: "/ui-manifest.json", headers: [{ key: "Cache-Control", value: "public, max-age=0, must-revalidate" }], }, ]; }, async rewrites() { return [ { source: "/api/:path*", destination: `${BACKEND_INTERNAL_URL}/api/:path*` } ]; } }; export default nextConfig;