From 69a61ee22cdf452c43898f796adef57cebcb3ac0 Mon Sep 17 00:00:00 2001 From: Samet Date: Fri, 22 Mar 2024 00:35:53 +0300 Subject: [PATCH] fix: applied cache_time variable to the cache-control directive --- middlewares/api/cache.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/middlewares/api/cache.ts b/middlewares/api/cache.ts index f2b3ce4..80d4948 100644 --- a/middlewares/api/cache.ts +++ b/middlewares/api/cache.ts @@ -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",