Skip to content

Commit 49684d6

Browse files
[Cache] Changes to cache headers (#17954)
* Changes to cache headers * Update src/content/docs/cache/how-to/cache-keys.mdx Co-authored-by: Jun Lee <[email protected]> --------- Co-authored-by: Jun Lee <[email protected]>
1 parent 108b89f commit 49684d6

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/content/docs/cache/how-to/cache-keys.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,22 @@ Headers control which headers go into the Cache Key. Similar to Query String, yo
8383

8484
When you include a header, the header value is included in the Cache Key. For example, if an HTTP request contains an HTTP header like `X-Auth-API-key: 12345`, and you include the `X-Auth-API-Key header` in your Cache Key Template, then `12345` appears in the Cache Key.
8585

86-
To check for the presence of a header without including its actual value, use the `check_presence` option.
86+
In the **Check if header contains** section, you can add header names and their values to the cache key. For custom headers, values are optional, but for the following restricted headers, you must include one to three specific values:
8787

88-
Currently, you can only exclude the `Origin` header. The `Origin` header is always included unless explicitly excluded. Including the [Origin header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) in the Cache Key is important to enforce [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS). Additionally, you cannot include the following headers:
89-
90-
* Headers that have high cardinality and risk sharding the cache
9188
* `accept`
9289
* `accept-charset`
9390
* `accept-encoding`
9491
* `accept-datetime`
9592
* `accept-language`
9693
* `referer`
9794
* `user-agent`
95+
96+
To check for the presence of a header without including its actual value, use the **Check presence of** option.
97+
98+
Currently, you can only exclude the `Origin` header. The `Origin` header is always included unless explicitly excluded. Including the [Origin header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) in the Cache Key is important to enforce [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS).
99+
100+
Additionally, you cannot include the following headers:
101+
98102
* Headers that re-implement cache or proxy features
99103
* `connection`
100104
* `content-length`

src/content/docs/cache/how-to/cache-rules/settings.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,17 @@ Define the request components used to define a [custom cache key](/cache/how-to/
178178
Enterprise customers have these additional options for custom cache keys:
179179

180180
* In the **Query string** section, you can select **All query string parameters**, **All query string parameters except** and enter an exception, **No query parameters except** and enter the parameters, or **Ignore query string** (also available for pay-as-you-go customers).
181-
* In the **Headers** section, you can include headers names and their values, check the presence of another header, and **Include origin header**.
181+
* In the **Headers** section, you can specify header names along with their values. For custom headers, values are optional; however, for the following restricted headers, you must include one to three specific values:
182+
183+
* `accept`
184+
* `accept-charset`
185+
* `accept-encoding`
186+
* `accept-datetime`
187+
* `accept-language`
188+
* `referer`
189+
* `user-agent`
190+
191+
To check for a header's presense wihtout including its value, use the **Check presence of** option. You can also choose whether to **Include origin header**.
182192
* In the **Cookie** section, you can include cookie names and their values, and check for the presence of another cookie.
183193
* In the **Host** section, you can select **Use original host** and **Resolved host**. In the **User** section, you can select **Device type**, **Country**, and **Language**.
184194

0 commit comments

Comments
 (0)