mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-10-28 00:35:48 -04:00
lengthen cache-control headers
This commit is contained in:
@@ -46,7 +46,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");
|
||||
res.setHeader("Cache-Control", "s-maxage=900, stale-while-revalidate=60");
|
||||
|
||||
// return in JSON format
|
||||
return res.status(200).json(siteStats);
|
||||
|
||||
@@ -41,8 +41,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 day
|
||||
res.setHeader("cache-control", "s-maxage=604800, stale-while-revalidate");
|
||||
// cache on edge for one week
|
||||
res.setHeader("cache-control", "s-maxage=604800, stale-while-revalidate=86400");
|
||||
res.write(JSON.stringify(manifest));
|
||||
res.end();
|
||||
|
||||
|
||||
@@ -47,7 +47,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");
|
||||
res.setHeader("cache-control", "s-maxage=43200, stale-while-revalidate=3600");
|
||||
|
||||
// next-sitemap takes care of the rest of the response for us
|
||||
return getServerSideSitemap(context, pages);
|
||||
|
||||
Reference in New Issue
Block a user