Skip to content

Commit

Permalink
extend no-cache for more controllers (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
znarf authored Apr 12, 2024
1 parent fcf424c commit 078dbff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/server/controllers/account-contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ const accountContributors = async (req, res) => {
switch (req.params.format) {
case 'txt':
case 'csv': {
// don't cache at CDN level as the result may contain private information
if (authorization || apiKey || personalToken) {
res.append('Cache-Control', 'no-cache');
}
if (req.params.format === 'csv') {
res.append('Content-Type', `text/csv;charset=utf-8`);
} else {
Expand Down
1 change: 1 addition & 0 deletions src/server/controllers/account-transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ const accountTransactions = async (req, res) => {
switch (req.params.format) {
case 'txt':
case 'csv': {
// don't cache at CDN level as the result may contain private information
if (authorization || apiKey || personalToken) {
res.append('Cache-Control', 'no-cache');
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/controllers/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export async function list(req, res, next) {
headers['Personal-Token'] = personalToken;
}

// don't cache at CDN level as the result contains private information
if (Object.keys(headers).length) {
// don't cache at CDN level as the result may contain private information
if (authorization || apiKey || personalToken) {
res.setHeader('cache-control', 'no-cache');
}

Expand Down

0 comments on commit 078dbff

Please sign in to comment.