Skip to content

Commit

Permalink
only cache response if response has cache-control header
Browse files Browse the repository at this point in the history
  • Loading branch information
psytrx committed May 9, 2023
1 parent e445f2e commit cd33a15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/adapter-cloudflare/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const worker = {

// write to `Cache` only if response is not an error,
// let `Cache.save` handle the Cache-Control and Vary headers
return res.status >= 400 ? res : Cache.save(req, res, context);
pragma = res.headers.get('cache-control') || '';
return pragma && res.status < 400 ? Cache.save(req, res, context) : res;
}
};

Expand Down

0 comments on commit cd33a15

Please sign in to comment.