]> git.ardis.lu - ardislu.dev/commitdiff
Update Cache-Control header
authorArdis Lu <ardisglu@gmail.com>
Sun, 27 Mar 2022 10:06:25 +0000 (03:06 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 27 Mar 2022 10:06:25 +0000 (03:06 -0700)
functions/api.js

index fe6d8b3efe9e02ca61105b36c741c19e662c147e..a5802380b84053e896b840d577435d1a4e40c367 100644 (file)
@@ -75,5 +75,8 @@ export async function onRequestGet({ request, env }) {
     }
   });
 
-  return response;
+  const newResponse = new Response(response.body, response);
+  newResponse.headers.set('Cache-Control', 'max-age=86400, stale-while-revalidate=604800');
+
+  return newResponse;
 }
This page took 0.042937 seconds and 4 git commands to generate.