diff --git a/apps/functions/dns-redirecting/index.ts b/apps/functions/dns-redirecting/index.ts index 37bfd0148..00aa7c269 100644 --- a/apps/functions/dns-redirecting/index.ts +++ b/apps/functions/dns-redirecting/index.ts @@ -47,7 +47,12 @@ export const dnsRedirecting = functions.https.onRequest( const versionsData = await fetch('https://material.angular.dev/assets/versions.json').then( (r) => r.json(), ); - response.set('Content-Type', 'application/json').send(JSON.stringify(versionsData)); + // 4 Days in seconds + const cacheDuration = 60 * 60 * 24 * 4; + response + .set('Cache-Control', `public, max-age=${cacheDuration}, s-maxage=${cacheDuration}`) + .set('Content-Type', 'application/json') + .send(JSON.stringify(versionsData)); return; } response.redirect(redirectType, `https://material.angular.dev${request.originalUrl}`); diff --git a/apps/functions/package.json b/apps/functions/package.json index dff88edb6..bed8166f0 100644 --- a/apps/functions/package.json +++ b/apps/functions/package.json @@ -1,7 +1,7 @@ { "name": "functions", "engines": { - "node": "18" + "node": "20" }, "main": "functions_compiled/index.cjs", "type": "module",