Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/content/docs/workers/runtime-apis/cache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ The `stale-while-revalidate` and `stale-if-error` directives are not supported w

`cache.put` returns a `413` error if `Cache-Control` instructs not to cache or if the response is too large.

:::note

`cache.put` will silently reject a `301` or `302` redirect response if both of the following are true:

1. The cache key does not include the query string (for example, a custom cache key set via Workers or Page Rules that strips the query string).
2. The `Location` header in the redirect response contains the request's query string.

This is a cache-poisoning mitigation. To cache redirect responses with query strings, either include the query string in your cache key, or remove the query string from the `Location` header before calling `cache.put()`. This restriction does not apply on `.workers.dev` domains, which include the query string in the cache key by default.

:::

### `Match`

```js
Expand Down