Ionosphere.tv
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf: add browser Cache-Control headers to Next.js pages

Pages had s-maxage (CDN only) but no max-age for browsers, causing
re-fetches on every navigation. client-metadata.json had max-age=0.

Now: pages cache 5min with stale-while-revalidate 1h, client-metadata
caches 24h. Repeat visits should be near-instant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+18
+18
apps/ionosphere/next.config.ts
··· 2 2 3 3 const nextConfig: NextConfig = { 4 4 output: "standalone", 5 + async headers() { 6 + return [ 7 + { 8 + // OAuth client metadata — changes very rarely 9 + source: "/client-metadata.json", 10 + headers: [ 11 + { key: "Cache-Control", value: "public, max-age=86400" }, 12 + ], 13 + }, 14 + { 15 + // ISR pages — browser can cache briefly, revalidate in background 16 + source: "/((?!api|_next).*)", 17 + headers: [ 18 + { key: "Cache-Control", value: "public, max-age=300, stale-while-revalidate=3600" }, 19 + ], 20 + }, 21 + ]; 22 + }, 5 23 }; 6 24 7 25 export default nextConfig;