construct_​response

Version: v2023-01-05Includes use: Yes

Behavior name: Construct Response

This behavior constructs an HTTP response, complete with HTTP status code and body, to serve from the edge independently of your origin. For example, you might want to send a customized response if the URL doesn't point to an object on the origin server, or if the end user is not authorized to view the requested content. You can use it with all request methods you allow for your property, including POST.

Request method behaviors:

Important: This behavior is not compatible with Bot Manager. For more information on routing bot traffic, see Set up alternate hostnames.

data "akamai_property_rules_builder" "construct_response" {
  rules_v2025_02_18 {
    name     = "Construct Response"
    comments = "Constructs an HTTP response."
    behavior {
      construct_response {
        ignore_purge = false
        enabled = true
        body = ""
        response_code = 200
        force_eviction = false
      }
    }
  }
}
"behaviors": [
  {
  "name": "constructResponse",
  "options": {
      "ignorePurge": false,
      "enabled": true,
      "body": "",
      "responseCode": 200,
      "forceEviction": false
    }
  }
]

Options

Option Description
enabled
Serves the custom response.
body
HTML response of up to 2000 characters to send to the end-user client.
response_code
The HTTP response code to send to the end-user client. Value is one of:
  • 200
  • 401
  • 403
  • 404
  • 405
  • 417
  • 500
  • 501
  • 502
  • 503
  • 504
force_eviction
For GET requests from clients, this forces edge servers to evict the underlying object from cache. Defaults to false.
ignore_purge
Whether to ignore the custom response when purging.