From 4da9d13be2694a56e162349ba3c1e42475c89a2d Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 24 Oct 2024 18:45:36 +0300 Subject: [PATCH] Modified next.config.js to add Cache-Control headers for all pages --- next.config.js | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/next.config.js b/next.config.js index 1346f5de..8235ec01 100644 --- a/next.config.js +++ b/next.config.js @@ -2,18 +2,18 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true', }) -const cspHeader = ` - default-src 'self'; - script-src 'self' 'unsafe-eval' 'unsafe-inline'; - style-src 'self' 'unsafe-inline'; - img-src 'self' blob: data:; - font-src 'self'; - object-src 'none'; - base-uri 'self'; - form-action 'self'; - frame-ancestors 'none'; - upgrade-insecure-requests; -` +// const cspHeader = ` +// default-src 'self'; +// script-src 'self' 'unsafe-eval' 'unsafe-inline'; +// style-src 'self' 'unsafe-inline'; +// img-src 'self' blob: data:; +// font-src 'self'; +// object-src 'none'; +// base-uri 'self'; +// form-action 'self'; +// frame-ancestors 'none'; +// upgrade-insecure-requests; +// ` /** @type {import('next').NextConfig} */ @@ -23,19 +23,19 @@ const nextConfig = { // largePageDataBytes: 168960 // 165kB; Default is 128kB // } - // async headers() { - // return [ - // { - // source: '/(.*)', - // headers: [ - // { - // key: 'Content-Security-Policy', - // value: cspHeader.replace(/\n/g, ''), - // }, - // ], - // }, - // ] - // } + async headers() { + return [ + { + source: '/(.*)', + headers: [ + { + key: 'Cache-Control', + value: 'no-cache, no-store, max-age=0' + }, + ], + }, + ] + } }