Files
FlockPal/backend/src/storage/photoCache.ts
T
Corey Blais 693a30f437
Deploy / deploy-dev (push) Skipped
Deploy / deploy-prod (push) Successful in 3m57s
Invites and fixed image caching
2026-10-09 20:16:22 -04:00

5 lines
399 B
TypeScript

// Never cache a redirect to a signed storage URL: its lifetime is independent of
// the app token. Successful proxy responses cannot outlive the app token.
export const photoCacheControl = (mode: 'proxy' | 'redirect', expiresAt: number, now = Math.floor(Date.now() / 1000)) =>
mode === 'redirect' ? 'no-store' : `private, max-age=${Math.max(0, Math.min(900, expiresAt - now))}, must-revalidate`;