Skip to content

Commit cd33a15

Browse files
committed
only cache response if response has cache-control header
1 parent e445f2e commit cd33a15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/adapter-cloudflare/src/worker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ const worker = {
5555

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

0 commit comments

Comments
 (0)