Version: v2024-04-29Includes use: Yes

Behavior name: Caching

Control content caching on edge servers: whether or not to cache, whether to honor the origin's caching headers, and for how long to cache. Note that any NO or BYPASS​CACHE HTTP headers set on the origin's content override this behavior. For more details on how caching works in Property Manager, see the Learn about caching section in the guide.

Default behavior

These samples reflect the behavior's default settings. You can use these as is in your configurations or make adjustments based on the behavior's available options.

data "akamai_property_rules_builder" "caching" {
  rules_v2025_02_18 {
    name     = "Caching"
    comments = "Controls content caching on edge servers."
    behavior {
      caching {
        behavior        = "MAX_AGE"
        must_revalidate = false
        ttl             = ""
      }
    }
  }
}
"behaviors": [
  {
    "name": "caching",
    "options": {
      "behavior": "MAX_AGE",
      "mustRevalidate": false,
      "ttl": ""
    }
  }
]

Options

Option Description
behavior
Specify the caching option. Value is one of:
  • MAX_​AGE. Honor the origin's MAX_​AGE header.
  • NO_​STORE. Clears the cache and serves from the origin.
  • BYPASS_​CACHE. Retains the cache but serves from the origin.
  • CACHE_​CONTROL_​AND_​EXPIRES. Honor the origin's CACHE_​CONTROL or EXPIRES header, whichever comes last. This adds support for the s-maxage response directive specified in RFC 7234. Use this alternative value to instruct a downstream CDN how long to cache content.
  • CACHE_​CONTROL. Honor the origin's CACHE_​CONTROL header. This adds support for the s-maxage response directive specified in RFC 7234. Use this alternative value to instruct a downstream CDN how long to cache content.
  • EXPIRES. Honor the origin's EXPIRES header.
must_​revalidate
Determines what to do once the cached content has expired, by which time the Akamai platform should have re-fetched and validated content from the origin. If enabled, only allows the re-fetched content to be served. If disabled, may serve stale content if the origin is unavailable.
ttl
The maximum time content may remain cached. Setting the value to 0 is the same as setting a no-cache header, which forces content to revalidate.
default_​ttl
The maximum time content may remain cached. Setting the value to 0 is the same as setting a no-cache header, which forces content to revalidate.
enhanced_​rfc_​support
This enables honoring particular Cache-Control header directives from the origin. Supports all official RFC 7234 directives except for no-transform.
honor_​no_​store
Instructs edge servers not to cache the response when the origin response includes the no-store directive.
honor_​private
Instructs edge servers not to cache the response when the origin response includes the private directive.
honor_​no_​cache
With the no-cache directive present in the response, this instructs edge servers to validate or refetch the response for each request. Effectively, set the time to live ttl to zero seconds.
honor_​max_​age
This instructs edge servers to cache the object for a length of time set by the max-age directive in the response. When present in the origin response, this directive takes precedence over the max-age directive and the default_​ttl setting.
honor_​s_​maxage
Instructs edge servers to cache the object for a length of time set by the s-maxage directive in the response. When present in the origin response, this directive takes precedence over the max-age directive and the default_​ttl setting.
honor_​must_​revalidate
This instructs edge servers to successfully revalidate with the origin server before using stale objects in the cache to satisfy new requests.
honor_​proxy_​revalidate
With the proxy-revalidate directive present in the response, this instructs edge servers to successfully revalidate with the origin server before using stale objects in the cache to satisfy new requests.