Check for capitalized cache control header

This commit is contained in:
rijkvanzanten
2020-12-22 17:53:33 -05:00
parent 0cbf5ee418
commit 2b64449f6c

View File

@@ -10,7 +10,8 @@ const checkCacheMiddleware: RequestHandler = asyncHandler(async (req, res, next)
if (env.CACHE_ENABLED !== true) return next();
if (!cache) return next();
if (req.headers['cache-control']?.includes('no-cache')) return next();
if (req.headers['cache-control']?.includes('no-cache') || req.headers['Cache-Control']?.includes('no-cache'))
return next();
const key = getCacheKey(req);
const cachedData = await cache.get(key);