diff --git a/apps/web/pages/api/logo.ts b/apps/web/pages/api/logo.ts index b3e7d859a9..c7cd820765 100644 --- a/apps/web/pages/api/logo.ts +++ b/apps/web/pages/api/logo.ts @@ -187,7 +187,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) } res.setHeader("Content-Type", response.headers.get("content-type") as string); - res.setHeader("Cache-Control", "s-maxage=86400"); + res.setHeader("Cache-Control", "s-maxage=86400, stale-while-revalidate=60"); res.send(buffer); } catch (error) { res.statusCode = 404; diff --git a/apps/web/pages/api/user/avatar.ts b/apps/web/pages/api/user/avatar.ts index a3881970c8..edb6fb24b2 100644 --- a/apps/web/pages/api/user/avatar.ts +++ b/apps/web/pages/api/user/avatar.ts @@ -67,6 +67,8 @@ async function getIdentityData(req: NextApiRequest) { export default async function handler(req: NextApiRequest, res: NextApiResponse) { const identity = await getIdentityData(req); const img = identity?.avatar; + // We cache for one day + res.setHeader("Cache-Control", "s-maxage=86400, stale-while-revalidate=60"); // If image isn't set or links to this route itself, use default avatar if (!img) { if (identity?.org) {