@cloudflare/pages-shared 0.11.37 → 0.11.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -492,7 +492,19 @@ export async function generateHandler<
492
492
  if (responseWithoutHeaders.status >= 500) {
493
493
  return responseWithoutHeaders;
494
494
  }
495
- return await attachHeaders(responseWithoutHeaders);
495
+
496
+ const responseWithHeaders = await attachHeaders(responseWithoutHeaders);
497
+ if (responseWithHeaders.status === 404) {
498
+ // Remove any user-controlled cache-control headers
499
+ // This is to prevent the footgun of potentionally caching this 404 for a long time
500
+ if (responseWithHeaders.headers.has("cache-control")) {
501
+ responseWithHeaders.headers.delete("cache-control");
502
+ }
503
+ // Add cache-control: no-store to prevent this from being cached on the responding zones.
504
+ responseWithHeaders.headers.append("cache-control", "no-store");
505
+ }
506
+
507
+ return responseWithHeaders;
496
508
 
497
509
  async function serveAsset(
498
510
  servingAssetEntry: AssetEntry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/pages-shared",
3
- "version": "0.11.37",
3
+ "version": "0.11.39",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cloudflare/workers-sdk.git",
@@ -13,11 +13,11 @@
13
13
  "metadata-generator/**/*"
14
14
  ],
15
15
  "dependencies": {
16
- "miniflare": "3.20240512.0"
16
+ "miniflare": "3.20240524.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@miniflare/storage-memory": "^2.14.2",
20
- "@cloudflare/workers-types": "^4.20240512.0",
20
+ "@cloudflare/workers-types": "^4.20240524.0",
21
21
  "@miniflare/cache": "^2.14.2",
22
22
  "@miniflare/core": "^2.14.2",
23
23
  "@miniflare/html-rewriter": "^2.14.2",