Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Add Cache-Control header to api responses

Maxime-Jedaa30f7b1d6
diff --git a/docker/middleware.js b/docker/middleware.js
index 85dab890e..75a74e021 100644
--- a/docker/middleware.js
+++ b/docker/middleware.js
@@ -9,6 +9,7 @@ const apiHeaders = {
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Methods': 'GET, DELETE, POST, PUT',
'Access-Control-Max-Age': process.env.CORS_MAX_AGE || '86400',
+ 'Cache-Control': 'no-cache',
};
const trackerHeaders = {
diff --git a/next.config.js b/next.config.js
index 590d7121b..e32484577 100644
--- a/next.config.js
+++ b/next.config.js
@@ -62,26 +62,30 @@ const trackerHeaders = [
const apiHeaders = [
{
key: 'Access-Control-Allow-Origin',
- value: '*'
+ value: '*',
},
{
key: 'Access-Control-Allow-Headers',
- value: '*'
+ value: '*',
},
{
key: 'Access-Control-Allow-Methods',
- value: 'GET, DELETE, POST, PUT'
+ value: 'GET, DELETE, POST, PUT',
},
{
key: 'Access-Control-Max-Age',
- value: corsMaxAge || '86400'
+ value: corsMaxAge || '86400',
+ },
+ {
+ key: 'Cache-Control',
+ value: 'no-cache',
},
];
const headers = [
{
source: '/api/:path*',
- headers: apiHeaders
+ headers: apiHeaders,
},
{
source: '/:path*',