1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-28 00:35:48 -04:00

update cache-control headers

This commit is contained in:
2022-06-13 20:07:12 -04:00
parent a63ea35463
commit 4e0ca9ff4d
9 changed files with 170 additions and 170 deletions

View File

@@ -53,7 +53,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const siteStats = await getSiteStats(client);
// let Vercel edge cache results for 15 mins
res.setHeader("Cache-Control", "s-maxage=900, stale-while-revalidate=60");
res.setHeader("Cache-Control", "public, max-age=0, s-maxage=900, stale-while-revalidate");
// return in JSON format
return res.status(200).json(siteStats);

View File

@@ -42,7 +42,8 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
// https://developer.mozilla.org/en-US/docs/Web/Manifest#deploying_a_manifest
res.setHeader("content-type", "application/manifest+json; charset=utf-8");
// cache on edge for one week
res.setHeader("cache-control", "s-maxage=604800, stale-while-revalidate=86400");
res.setHeader("cache-control", "public, max-age=0, s-maxage=604800, stale-while-revalidate");
res.write(JSON.stringify(manifest));
res.end();

View File

@@ -57,7 +57,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
// cache on edge for 12 hours
const { res } = context;
res.setHeader("cache-control", "s-maxage=43200, stale-while-revalidate=3600");
res.setHeader("cache-control", "public, max-age=0, s-maxage=43200, stale-while-revalidate");
res.setHeader("content-type", "application/xml; charset=utf-8");
// finally write the resulting XML