Skip to content

Commit 7be21bb

Browse files
committed
[Cache] SEO: cache-control header
1 parent dcdcbda commit 7be21bb

File tree

11 files changed

+18
-17
lines changed

11 files changed

+18
-17
lines changed

src/content/docs/cache/advanced-configuration/cache-reserve.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Cache Reserve is a large, persistent data store [implemented on top of R2](/r2/)
99

1010
![Content served from origin and getting cached in Cache Reserve, and Edge Cache Data Centers (T1=upper-tier, T2=lower-tier) on its way back to the client](~/assets/images/cache/content-being-served.png)
1111

12-
How long content in Cache Reserve will be considered “fresh” is determined by Edge Cache TTL setting or Cache-Control headers at your origin, if [Edge Cache TTL](/cache/how-to/edge-browser-cache-ttl/#edge-cache-ttl) is not set. After freshness expires, Cloudflare will attempt to revalidate the asset when a subsequent request arrives in Cache Reserve for the asset. This is the same behavior as in Cloudflare's regular CDN.
12+
How long content in Cache Reserve will be considered “fresh” is determined by Edge Cache TTL setting or [Cache-Control headers at your origin](/cache/concepts/cache-control/), if [Edge Cache TTL](/cache/how-to/edge-browser-cache-ttl/#edge-cache-ttl) is not set. After freshness expires, Cloudflare will attempt to revalidate the asset when a subsequent request arrives in Cache Reserve for the asset. This is the same behavior as in Cloudflare's regular CDN.
1313

1414
The retention period of an asset is how long we will keep the asset in Cache Reserve before marking it for eviction. If an asset is not requested within the retention period, it will be evicted from Cache Reserve. Accessing the asset will extend the retention period by one period. By default, the Cache Reserve retention period is 30 days.
1515

src/content/docs/cache/concepts/cache-control.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pcx_content_type: concept
44
head:
55
- tag: title
66
content: Origin Cache Control
7+
description: Learn how the 'cache-control' header works with Cloudflare's Origin Cache Control feature, which ensures that Cloudflare respects caching directives from your origin server.
78

89
---
910

@@ -24,9 +25,9 @@ In the following sections, we will provide more details regarding:
2425
* How Origin Cache Control behaves with `Cache-Control` directives.
2526
* How other Cloudflare products interact with `Cache-Control` directives.
2627

27-
## `Cache-control` directives
28+
## `Cache-control` header directives
2829

29-
A `Cache-Control` header can include a number of directives, and the directive dictates who can cache a resource along with how long those resources can be cached before they must be updated.
30+
A `Cache-Control` header can include a number of directives. The `Cache-Control` header's directives dictate who can cache a resource along with how long those resources can be cached before they must be updated.
3031

3132
:::note[Note]
3233

@@ -86,7 +87,7 @@ The `stale-if-error` directive is ignored if [Always Online](/cache/how-to/alway
8687
Additional directives that influence cache behavior are listed below.
8788

8889
* `no-transform` — Indicates that an intermediary — regardless of whether it implements a cache — must not transform the payload.
89-
* `vary` — Cloudflare does not consider vary values in caching decisions. Nevertheless, vary values are respected when [Vary for images](/cache/advanced-configuration/vary-for-images/) is configured and when the vary header is [`vary: accept-encoding`](/speed/optimization/content/compression/).
90+
* `vary` — Cloudflare does not consider vary values in caching decisions. Nevertheless, vary values are respected when [Vary for images](/cache/advanced-configuration/vary-for-images/) is configured and when the vary `cache-control` header is [`vary: accept-encoding`](/speed/optimization/content/compression/).
9091
* `immutable` — Indicates to clients the response body does not change over time. The resource, if unexpired, is unchanged on the server. The user should not send a conditional revalidation request, such as `If-None-Match` or `If-Modified-Since`, to check for updates, even when the user explicitly refreshes the page. This directive has no effect on public caches like Cloudflare, but does change browser behavior.
9192

9293
### Understand `no-store` and `no-cache` directives

src/content/docs/cache/concepts/cache-responses.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The resource was served from Cloudflare's cache but was expired. Cloudflare coul
4747

4848
## BYPASS
4949

50-
The origin web server instructed Cloudflare to bypass cache via a `Cache-Control` header set to `no-cache`, `private`, or `max-age=0` even though Cloudflare originally preferred to cache the asset. BYPASS is returned when enabling [Origin Cache-Control](/cache/concepts/cache-control/). Cloudflare also sets BYPASS when your origin web server sends cookies in the response header. If the Request to your origin web server includes an `Authorization` header, in some cases the response will also be BYPASS. Refer to [Conditions](/cache/concepts/cache-control/#conditions) in the Origin Cache-Control behavior section for more details.
50+
The origin web server instructed Cloudflare to bypass cache via a [`Cache-Control` header](/cache/concepts/cache-control/) set to `no-cache`, `private`, or `max-age=0` even though Cloudflare originally preferred to cache the asset. BYPASS is returned when enabling [Origin Cache-Control](/cache/concepts/cache-control/). Cloudflare also sets BYPASS when your origin web server sends cookies in the response header. If the Request to your origin web server includes an `Authorization` header, in some cases the response will also be BYPASS. Refer to [Conditions](/cache/concepts/cache-control/#conditions) in the Origin Cache-Control behavior section for more details.
5151

5252
## REVALIDATED
5353

src/content/docs/cache/concepts/customize-cache.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ For example, add a `static=true` query string for resources at your origin web s
2727
* Using the Expression Builder: `Hostname contains "example.com" AND URI Query String contains "static=true"`
2828
* Using the Expression Editor: `(http.host contains "example.com" and http.request.uri.query contains "static=true")`
2929

30-
Resources that match a Cache Everything Cache Rule are still not cached if the origin web server sends a Cache-Control header of `max-age=0`, `private`, `no-cache`, or an `Expires` header with an already expired date. Include the [Edge Cache TTL](/cache/how-to/cache-rules/settings/#edge-ttl) setting within the Cache Everything Cache Rule to additionally override the `Cache-Control` headers from the origin web server.
30+
Resources that match a Cache Everything Cache Rule are still not cached if the origin web server sends a [Cache-Control header](/cache/concepts/cache-control/) of `max-age=0`, `private`, `no-cache`, or an `Expires` header with an already expired date. Include the [Edge Cache TTL](/cache/how-to/cache-rules/settings/#edge-ttl) setting within the Cache Everything Cache Rule to additionally override the `Cache-Control` headers from the origin web server.

src/content/docs/cache/concepts/default-cache-behavior.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { FeatureTable } from "~/components"
1212
Cloudflare respects the origin web server’s cache headers in the following order unless an [Edge Cache TTL cache rule](/cache/how-to/cache-rules/settings/#edge-ttl) overrides the headers. Refer to the [Edge TTL](/cache/how-to/configure-cache-status-code/#edge-ttl) section for details on default TTL behavior.
1313

1414
* Cloudflare **does not** cache the resource when:
15-
* The `Cache-Control` header is set to `private`, `no-store`, `no-cache`, or `max-age=0`.
15+
* The [`Cache-Control` header](/cache/concepts/cache-control/) is set to `private`, `no-store`, `no-cache`, or `max-age=0`.
1616
* The [Set-Cookie header](/cache/concepts/cache-behavior/#interaction-of-set-cookie-response-header-with-cache) exists.
1717
* The HTTP request method is anything other than a `GET`.
1818
* Cloudflare **does** cache the resource when:

src/content/docs/cache/how-to/cache-rules/examples/cache-ttl-by-status-code.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Example, Render } from "~/components"
2424
* **Then**:
2525
* **Cache eligibility**: Eligible for cache
2626
* **Setting**: Edge TTL
27-
* Use cache-control header if present, use default Cloudflare caching behavior if not
27+
* Use [cache-control header](/cache/concepts/cache-control/) if present, use default Cloudflare caching behavior if not
2828
* **Status code TTL**:
2929
* **Scope**: *Range*
3030
* **From**: *200*

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ If you use cache rules, image transformations, and zone versioning simultaneousl
8181

8282
Edge Cache TTL refers to the maximum cache time-to-live (TTL), or how long an asset should be considered fresh or available to serve from Cloudflare’s cache in response to requests. This setting has three primary options:
8383

84-
- **Use cache control-header if present, bypass cache if not**: If a cache-control header is present on the response, follow its directives. If not, skip caching entirely.
84+
- **Use cache control-header if present, bypass cache if not**: If a [cache-control header](/cache/concepts/cache-control/) is present on the response, follow its directives. If not, skip caching entirely.
8585
- **Use cache-control header if present, use default Cloudflare caching behavior if not**: If a cache-control header is present on the response, follow its directives. If not, cache in accordance with our [default edge TTL settings](/cache/how-to/configure-cache-status-code/#edge-ttl).
8686
- **Ignore cache-control header and use this TTL**: Completely ignore any cache-control header on the response and instead cache the response for a duration specified in the timing dropdown.
8787

@@ -93,7 +93,7 @@ API configuration object name: `"edge_ttl"`.
9393

9494
| API values | Configuration |
9595
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
96-
| `respect_origin` | Use cache-control header if present, use default [Cloudflare caching behavior](/cache/concepts/default-cache-behavior/) if not. |
96+
| `respect_origin` | Use [cache-control header](/cache/concepts/cache-control/) if present, use default [Cloudflare caching behavior](/cache/concepts/default-cache-behavior/) if not. |
9797
| `override_origin` | Ignore cache-control header and use this TTL. |
9898
| `bypass_by_default` | Use cache control-header if present, bypass cache if not. |
9999
| | |

src/content/docs/cache/how-to/edge-browser-cache-ttl/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For more information on how to set up Edge Cache TTL, refer to [Cache rules](/ca
1616

1717
## Browser Cache TTL
1818

19-
The Browser Cache TTL sets the expiration for resources cached in a visitor’s browser. By default, Cloudflare honors the cache expiration set in your `Expires` and `Cache-Control` headers but overrides those headers if:
19+
The Browser Cache TTL sets the expiration for resources cached in a visitor’s browser. By default, Cloudflare honors the cache expiration set in your `Expires` and [`Cache-Control` headers](/cache/concepts/cache-control/) but overrides those headers if:
2020

2121
* The value of the `Expires` or `Cache-Control` header from the origin web server is less than the Browser Cache TTL Cloudflare setting.
2222
* The origin web server does not send a `Cache-Control` or an `Expires` header.
@@ -28,7 +28,7 @@ Unless specifically set in a cache rule, Cloudflare does not override or insert
2828

2929
* Setting high Browser Cache TTL values means that the assets will be cached for a long time by users’ browsers.
3030
* If you modify cached assets, the new assets may not be displayed to repeat visitors before the Browser Cache TTL expires.
31-
* Purging Cloudflare’s cache does not affect assets stored by a visitor’s browser.
31+
* Purging Cloudflare’s cache does not affect assets stored by a visitor’s browser.
3232
:::
3333

3434
<FeatureTable id="cache.browser_cache_ttl" />

src/content/docs/cache/how-to/edge-browser-cache-ttl/set-browser-ttl.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar:
88

99
Specify a time for a visitor’s Browser Cache TTL to accelerate the page load for repeat visitors to your website. To configure cache duration within Cloudflare’s data centers, refer to [Edge Cache TTL](/cache/how-to/cache-rules/settings/#edge-ttl).
1010

11-
By default, Cloudflare honors the cache expiration set in your `Expires` and `Cache-Control` headers. Cloudflare overrides any `Cache-Control` or `Expires` headers with values set via the **Browser Cache TTL** option under **Caching** on your dashboard if:
11+
By default, Cloudflare honors the cache expiration set in your `Expires` and [`Cache-Control` headers](/cache/concepts/cache-control/). Cloudflare overrides any `Cache-Control` or `Expires` headers with values set via the **Browser Cache TTL** option under **Caching** on your dashboard if:
1212

1313
* The value of the `Cache-Control` header from the origin web server is less than the **Browser Cache TTL** setting. This means that **Browser cache TTL** value needs to be higher than origin `max-age`.
1414
* The origin web server does not send a `Cache-Control` or an `Expires` header.
@@ -33,7 +33,7 @@ If you modify cached assets, the new asset is not displayed to repeat visitors b
3333
2. Select **Caching**.
3434
3. Under **Browser Cache TTL**, select the drop-down menu to select the desired cache expiration time.
3535

36-
The **Respect Existing Headers** option tells Cloudflare to honor the settings in the `Cache-Control` headers from your origin web server.
36+
The **Respect Existing Headers** option tells Cloudflare to honor the settings in the [`Cache-Control` headers](/cache/concepts/cache-control/) from your origin web server.
3737

3838
:::note[Respect Existing Headers Availability]
3939

src/content/docs/rules/reference/page-rules-migration.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ You configured a Page Rule turning on caching of every response with status code
537537
- **Then**:
538538
- **Cache eligibility**: Eligible for cache
539539
- **Setting**: Edge TTL
540-
- Use cache-control header if present, use default Cloudflare caching behavior if not
540+
- Use [cache-control header](/cache/concepts/cache-control/) if present, use default Cloudflare caching behavior if not
541541
- **Status code TTL**:
542542
- **Scope**: _Range_
543543
- **From**: _200_
@@ -803,7 +803,7 @@ You configured a Page Rule adjusting Edge Cache TTL for all subdomains of `examp
803803
- **Then**:
804804
- **Cache eligibility**: Eligible for cache
805805
- **Setting**: Edge TTL
806-
- Ignore cache-control header and use this TTL
806+
- Ignore [cache-control header](/cache/concepts/cache-control/) and use this TTL
807807
- **Input time-to-live (TTL)**: _1 day_
808808

809809
</div>

0 commit comments

Comments
 (0)