Skip to content

Commit 489ae30

Browse files
committed
Allow Cloudflare to cache 404s
1 parent 4cad762 commit 489ae30

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cloudflare/workers.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ const REPLACE_STRIPPED_QUERYSTRING_ON_REDIRECT_LOCATION = false;
7474
// Disabled by default, but highly recommended
7575
const STRIP_VALUELESS_QUERYSTRING_KEYS = false;
7676

77-
// Only these status codes should be considered cacheable
77+
// Only these status codes should be considered cacheable.
7878
// (from https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4)
79-
const CACHABLE_HTTP_STATUS_CODES = [200, 203, 206, 300, 301, 410];
79+
// 404 is added to reduce server load on spammed requests.
80+
const CACHABLE_HTTP_STATUS_CODES = [200, 203, 206, 300, 301, 410, 404];
8081

8182
addEventListener('fetch', (event) => {
8283
event.respondWith(main(event));

0 commit comments

Comments
 (0)