Skip to content

armgit / bygga

Public Imported from GitHub
0

IKEA assembly, step by step: animated, manual-style 3D guides. Scan any paper manual with Together AI.

TypeScript

Cache share cards at the CDN, keep the clip list fresh

Youssef4a6b23bdbe8a
diff --git a/next.config.ts b/next.config.ts
index 3c8be3d..a7402fb 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -12,6 +12,15 @@ const nextConfig: NextConfig = {
},
async headers() {
return [
+ {
+ // share cards only change on deploy: let the CDN keep them, so a viral link renders each card once
+ source: "/:path(opengraph-image|twitter-image)",
+ headers: [{ key: "Cache-Control", value: "public, max-age=3600, s-maxage=31536000, stale-while-revalidate=86400" }],
+ },
+ {
+ source: "/build/:slug/:img(opengraph-image|twitter-image)",
+ headers: [{ key: "Cache-Control", value: "public, max-age=3600, s-maxage=31536000, stale-while-revalidate=86400" }],
+ },
{
// the service worker itself must never be stale
source: "/sw.js",
@@ -22,6 +31,11 @@ const nextConfig: NextConfig = {
source: "/voice/:path*",
headers: [{ key: "Cache-Control", value: "public, max-age=604800, stale-while-revalidate=2592000" }],
},
+ {
+ // the list of clips changes with every recording, so it is checked often
+ source: "/voice/:voice/manifest.json",
+ headers: [{ key: "Cache-Control", value: "public, max-age=300, stale-while-revalidate=3600" }],
+ },
];
},
async redirects() {