cache_​post

Version: v2025-02-18Includes use: Yes

Behavior name: Cache POST Responses

By default, POST requests are passed to the origin. This behavior overrides the default, and allows you to cache POST responses.

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" "cache_post" {
  rules_v2025_02_18 {
    name     = "Cache POST Responses"
    comments = "Overrides the default POST settings, and allows you to cache responses."
    behavior {
      cache_post {
        enabled  = true
        use_body = "ignore"
      }
    }
  }
}
"behaviors": [
  {
    "name": "cachePost",
    "options": {
      "enabled": true,
      "useBody": "IGNORE"
    }
  }
]

Options

Option Description
enabled
Enables caching of POST responses.
use_​body
Define how and whether to use the POST message body as a cache key. Value is one of:
  • IGNORE. Uses only the URL to cache the response.
  • MD5. Adds a string digest of the data as a query parameter to the cache URL.
  • QUERY. Adds the raw request body as a query parameter to the cache key, but only if the POST request's Content-Type is application/x-www-form-urlencoded(Use this in conjunction with cache​_id to define relevant query parameters.)