1fbeea14e6
Next.js serves /public files with `Cache-Control: public, max-age=0, must-revalidate`, so the home covers + first-act JSON were re-fetched on every visit. Verified against 30 days of Vercel metrics: /home/* alone was ~62% of Fast Data Transfer egress (5.42 GB) while the files total only ~31 MB — the same bytes re-downloaded hundreds of times. Add a headers() rule scoping `public, max-age=31536000, immutable` to /home/:path* only; other paths keep their defaults (verified /icon.svg still returns no-cache). Filenames under /home are stable (covers fN/mN.webp, first-act JSON by card name), so immutable is safe; if a first-act JSON is ever re-baked under the same name, bump a query string or purge the cache. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
23 lines
542 B
TypeScript
23 lines
542 B
TypeScript
import type { NextConfig } from "next";
|
|
|
|
const config: NextConfig = {
|
|
reactStrictMode: true,
|
|
typedRoutes: false,
|
|
turbopack: {
|
|
root: __dirname,
|
|
},
|
|
// /public defaults to `max-age=0, must-revalidate`; pin the stable /home/* covers + first-act JSON for 1y so browsers/CDN stop re-downloading them.
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: "/home/:path*",
|
|
headers: [
|
|
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
|
|
],
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default config;
|