Skip to content

Commit

Permalink
fix: applied cache_time variable to the cache-control directive
Browse files Browse the repository at this point in the history
  • Loading branch information
sametcodes committed Mar 21, 2024
1 parent ba7e946 commit 69a61ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion middlewares/api/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export const setCacheControl = (
query: { cache_time, _vercel_no_cache },
} = res.locals;

res.setHeader("Cache-Control", "max-age=60, stale-while-revalidate=2592000");
res.setHeader(
"Cache-Control",
`max-age=${cache_time}, stale-while-revalidate=2592000`
);
if (_vercel_no_cache === undefined) {
res.setHeader(
"CDN-Cache-Control",
Expand Down

0 comments on commit 69a61ee

Please sign in to comment.