constructResponse

  • Property Manager name: Construct Response
  • Behavior version: The v2024-02-12 rule format supports the constructResponse behavior v1.3.
  • Rule format status: GA, stable
  • Access: Read-write
  • Allowed in includes: Yes

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. For more details, see the allow‚ÄčOptions, allow‚ÄčPatch, allow‚ÄčPost, allow‚ÄčPut, and allow‚ÄčDelete behaviors.

Don't use this behavior with Bot Manager when you set up alternate hostnames to send bot traffic to an alternate page or site. Make sure the construct‚ÄčResponse behavior is disabled in that case.

OptionTypeDescriptionRequires
enabledboolean

Serves the custom response.

{"displayType":"boolean","tag":"input","type":"checkbox"}
bodystring (allows variables)

HTML response of up to 2000 characters to send to the end-user client.

{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"enabled","op":"eq","value":true}}
response‚ÄčCodeenum

The HTTP response code to send to the end-user client.

{"displayType":"enum","options":["200","404","401","403","405","417","500","501","502","503","504"],"tag":"select"}
{"if":{"attribute":"enabled","op":"eq","value":true}}
Supported values:
200
401
403
404
405
417
500
501
502
503
504
force‚ÄčEvictionboolean

For GET requests from clients, this forces edge servers to evict the underlying object from cache. Defaults to false.

{"displayType":"boolean","tag":"input","type":"checkbox"}
{"if":{"attribute":"enabled","op":"eq","value":true}}
ignore‚ÄčPurgeboolean

Whether to ignore the custom response when purging.

{"displayType":"boolean","tag":"input","type":"checkbox"}
{"if":{"attribute":"enabled","op":"eq","value":true}}