5 lines
399 B
TypeScript
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`;
|