more aggresive cache

This commit is contained in:
Daniel Bulant 2022-12-10 18:01:18 +01:00
parent 2a9f699b1b
commit db7af4bbef

View file

@ -5,6 +5,7 @@ export async function GET({ url }) {
const ret = await fetch(url.searchParams.get('url'));
return new Response(await ret.arrayBuffer(), {
headers: {
...ret.headers,
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, HEAD, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Accept, X-Requested-With',
@ -12,7 +13,7 @@ export async function GET({ url }) {
'Content-Type': ret.headers.get('Content-Type')!,
'Cache-Control': 'public, max-age=172800', // 2 days
'Cache-Control': 'public, max-age=172800, immutable, stale-while-revalidate=345600, state-if-error=604800',
'Expires': new Date(Date.now() + 172800000).toUTCString()
},
});