Available settings (2)·续
"action_parameters": {
"cache": true
"cache_reserve": {
"eligible": true,
"minimum_file_size": 100000
}
}
Note
If <code>minimum_file_size</code> is omitted and <code>eligible</code> is true, Cloudflare will use 0 bytes by default.
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-requests">Create a cache rule via API</a> for complete API examples.
</details>
Caching on Port (Enterprise-only)
Cloudflare supports several network ports by default, like 80 or 443. Some ports, traditionally admin ports, are supported but have caching disabled as they are used to manage sensitive information that should be ineligible for cache. Enterprise customers wanting to enable caching on these admin ports can cache on these ports by entering their desired port.
Note
Cloudflare supports many ports by default and will cache on them without needing this rule to be configured. For ports that Cloudflare supports, but for which caching is disabled, use this rule.
<details>
<summary>
API information
</summary>
API configuration property name: <code>"additional_cacheable_ports"</code> (array of integer values).
API configuration examplejson
"action_parameters": {
"cache": true
"additional_cacheable_ports": [8443, 8080]
}
}
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-requests">Create a cache rule via API</a> for complete API examples.
</details>
Proxy Read Timeout (Enterprise-only)
Defines a timeout value between two successive read operations to your origin server. The default value can be found in the Connection limits table. If you are attempting to reduce HTTP 524 errors because of timeouts from an origin server, try increasing this timeout value using the API endpoint below.
<details>
<summary>
API information
</summary>
API configuration property name: <code>"read_timeout"</code> (integer).
API configuration examplejson
"action_parameters": {
"cache": true,
"read_timeout": 900
}
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-requests">Create a cache rule via API</a> for complete API examples.
</details>
Serve stale content while revalidating
Defines if Cloudflare will serve stale content while updating the latest content from the origin server. If serving stale content is disabled, Cloudflare will not serve stale content while getting the latest content from the origin.
<details>
<summary>
API information
</summary>
API configuration property name: <code>"serve_stale"</code> > <code>"disable_stale_while_updating"</code> (boolean).
API configuration examplejson
"action_parameters": {
"cache": true,
"serve_stale": {
"disable_stale_while_updating": true
}
}
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-requests">Create a cache rule via API</a> for complete API examples.
</details>
Origin range requests
Origin Range Requests let Cloudflare fetch large files from your origin in cache-aligned byte ranges. Cloudflare may expand a client range and issue several single-range origin requests. Your origin may receive ranges that differ from the client's Range header.
This setting does not make a request or response cacheable. Cloudflare can use origin range fetching for an eligible GET even if the response is not stored. File-size limits apply to the complete object, not the requested range. Cache Reserve does not support Origin Range Requests.
Cloudflare asks the origin for unencoded content. Origins should return compatible range responses throughout the request. If an origin ignores Range and returns 200 OK, Cloudflare can use the response but must download the complete file. For all origin and client response requirements, refer to Range request behavior.
<details>
<summary>
API information
</summary>
API configuration object name: <code>"origin_range_requests"</code>.
The <code>mode</code> property accepts these values:
| Value | Behavior |
|---|---|
| <code>on</code> | Allows Cloudflare to generate origin range requests for matching, eligible <code>GET</code> requests. |
| <code>off</code> | Does not generate Origin Range Requests. Cloudflare can still serve ranges from a complete cached file. |
| <code>default</code> | Applies no rule override. Cloudflare uses its platform default. No file extensions are currently turned on by default. |
The <code>mode</code> property is required. The <code>on</code> and <code>off</code> modes override the default behavior for matching requests.
The <code>off</code> mode controls only range requests generated by Origin Range Requests. On a cacheable miss, Cloudflare may remove the client's <code>Range</code> header and fetch the complete file. If caching is bypassed or the request is not eligible for caching, Cloudflare may forward the client's original <code>Range</code> header.
API configuration examplejson
"action_parameters": {
"cache": true,
"origin_range_requests": {
"mode": "on"
}
}
To override Cloudflare's default behavior, use <code>off</code> in a rule that matches the affected traffic.
Turn off default Origin Range Requestsjson
"action_parameters": {
"origin_range_requests": {
"mode": "off"
}
}
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-turn-off-default-origin-range-requests">Create a cache rule via API</a> for a complete opt-out example.
</details>
Respect Strong ETags
Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and the origin server. When enabled, Cloudflare will use strong ETag header validation to ensure that resources in the Cloudflare cache and on the origin server are byte-for-byte identical. If disabled, Cloudflare converts ETag headers into weak ETag headers.
<details>
<summary>
API information
</summary>
API configuration property name: <code>"respect_strong_etags"</code> (boolean).
API configuration examplejson
"action_parameters": {
"cache": true,
"respect_strong_etags": true
}
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-requests">Create a cache rule via API</a> for complete API examples.
</details>
Origin error page pass-through
Turn on or off Cloudflare error pages generated from error HTTP status codes sent from the origin server. If enabled, this setting enables the use of error pages issued by the origin.
<details>
<summary>
API information
</summary>
API configuration property name: <code>"origin_error_page_passthru"</code> (boolean).
API configuration examplejson
"action_parameters": {
"cache": true,
"origin_error_page_passthru": true
}
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-requests">Create a cache rule via API</a> for complete API examples.
</details>
Origin Cache Control (Enterprise-only)
When this option is enabled, Cloudflare will aim to strictly adhere to RFC 7234 ↗︎. Enterprise customers have the ability to select if Cloudflare will adhere to this behavior. Free, Pro, and Business customers have this option enabled by default and cannot disable it.
<details>
<summary>
API information
</summary>
API configuration property name: <code>"origin_cache_control"</code> (boolean).
API configuration examplejson
"action_parameters": {
"cache": true
"origin_cache_control": true
}
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-requests">Create a cache rule via API</a> for complete API examples.
</details>
Vary
The Vary response header lets your origin cache multiple versions of the same URL based on request headers. Use the vary object to configure how Cloudflare handles each header your origin lists in its Vary response. For how Vary affects cache keys and how normalization works, refer to Vary.
The vary object supports these keys:
| Key | Required | Description |
|---|---|---|
default |
Yes | Configuration for any header name in the origin Vary response that is not included in headers. |
headers |
No | A map of lowercase request header names to configuration objects. |
If the vary object is omitted, this Cache Rules Vary setting is turned off. Other Vary behavior, such as Vary: *, Vary for images, and compression handling, is unaffected. If the vary object is present, default is required. An empty vary object is invalid.
Each header configuration object, and the default object, must include an action key set to one of normalize, passthrough, or bypass. Refer to Actions for guidance on when to use each.
Additional parameters can be specified for certain header names:
| Header | Additional key | Description |
|---|---|---|
accept |
media_types |
List of MIME types to include when normalizing the Accept header. Maximum 10 items. |
accept-language |
languages |
List of languages to include when normalizing the Accept-Language header. Maximum 20 items. |
For most deployments, start with a restrictive default and explicit per-header configuration:
- Use
defaultset tobypassto avoid caching variants for unexpected originVaryheaders. - Add explicit
headersentries for the headers you expect your origin to vary on. - Use
normalizeforaccept,accept-language, andaccept-encodingunless your origin requires raw header values. - Use
media_typesandlanguagesallowlists when you know the exact variants your origin can serve. - Use
passthroughonly when exact raw header values should select different cached versions. - Use
bypassfor high-cardinality headers such asuser-agent, cookies, or request headers with per-user values.
The following limits and validation rules apply:
- Header names in
headersmust be lowercase. - Header names can contain letters, numbers, underscores, and hyphens.
- Header names cannot exceed 128 characters.
- Header names beginning with
cf-orcf_are not allowed. - Certain hop-by-hop or cache-control headers, such as
connection,host, andcache-control, are not allowed. headerscan contain up to 50 entries.accept.media_typescan contain up to 10 entries.accept-language.languagescan contain up to 20 entries.- Values in
media_typesandlanguagesmust be non-empty printable ASCII.
<details>
<summary>
API information
</summary>
API configuration object name: <code>"vary"</code>.
The following example normalizes <code>accept</code> and <code>accept-language</code>, and bypasses cache for any other header in the origin <code>Vary</code> response:
API configuration examplejson
"action_parameters": {
"cache": true,
"vary": {
"default": {
"action": "bypass"
},
"headers": {
"accept": {
"action": "normalize",
"media_types": ["text/html", "application/json"]
},
"accept-language": {
"action": "normalize",
"languages": ["en", "fr", "de"]
}
}
}
}
Refer to <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/create-api/#example-requests">Create a cache rule via API</a> for complete API examples, or to the <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/terraform-example/">Terraform example</a>.
</details>
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/cache/how-to/cache-rules/settings/#page","headline":"Available settings","description":"Available settings for Cache Rules.","url":"https://developers.cloudflare.com/cache/how-to/cache-rules/settings/","inLanguage":"en","image":"https://developers.cloudflare.com/cache/how-to/cache-rules/settings/og.png?v=d29a9d2e0afd40e0","dateModified":"2026-10-15","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Create Cache Rules using Terraform. title: Terraform example image: https://developers.cloudflare.com/cache/how-to/cache-rules/terraform-example/og.png?v=2e1998f2e9c40d4f
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/cache/llms.txt
Use this file to discover all available pages before exploring further.
Docs