Skip to content

Commit d7d7bcd

Browse files
authored
fix: set avatar cache control (calcom#11163)
1 parent 4c861b9 commit d7d7bcd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

apps/web/pages/api/logo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
187187
}
188188

189189
res.setHeader("Content-Type", response.headers.get("content-type") as string);
190-
res.setHeader("Cache-Control", "s-maxage=86400");
190+
res.setHeader("Cache-Control", "s-maxage=86400, stale-while-revalidate=60");
191191
res.send(buffer);
192192
} catch (error) {
193193
res.statusCode = 404;

apps/web/pages/api/user/avatar.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ async function getIdentityData(req: NextApiRequest) {
6767
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
6868
const identity = await getIdentityData(req);
6969
const img = identity?.avatar;
70+
// We cache for one day
71+
res.setHeader("Cache-Control", "s-maxage=86400, stale-while-revalidate=60");
7072
// If image isn't set or links to this route itself, use default avatar
7173
if (!img) {
7274
if (identity?.org) {

0 commit comments

Comments
 (0)