| Version: v2023-09-20 | Includes use: Yes | 
|---|
Behavior name: Site Failover
Specifies how to respond when the origin is not available: by serving stale content, by serving an error page, or by redirecting.  To apply this behavior, you should match on an origin_timeout or match_response_code.
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" "fail_action" {
  rules_v2023_09_20 {
    name     = "Site Failover"
    comments = "Specifies how to respond when the origin is not available"
    behavior {
      fail_action {
        enabled                = true
        action_type            = "REDIRECT"
        redirect_hostname_type = "ALTERNATE"
        redirectHostname       = ""
        redirect_custom_path   = true
        redirect_path          = ""
        redirect_method        = 302
        preserve_query_string  = true
        modify_protocol        = false
      }
    }
  }
}
"behaviors": [
  {
  "name": "failAction",
  "options": {
    "enabled": true,
    "actionType": "REDIRECT",
    "redirectHostnameType": "ALTERNATE",
    "redirectHostname": "",
    "redirectCustomPath": true,
    "redirectPath": "",
    "redirectMethod": 302,
    "preserveQueryString": true,
    "modifyProtocol": false
    }
  }
]
Options
| Option | Description | 
|---|---|
| enabled | When enabled in case of a failure to contact the origin, the current behavior applies.
         | 
| action_type | Specifies the basic action to take when there is a failure to contact the origin. Value is one of:
           
 | 
| saas_type | Identifies the component of the request that identifies the SaaS dynamic fail action. Value is one of:
           
 | 
| saas_cname_enabled | Specifies whether to use a CNAME chain to determine the hostname for the SaaS dynamic fail action.
         | 
| saas_cname_level | Specifies the number of elements in the CNAME chain backwards from the edge hostname that determines the hostname for the SaaS dynamic fail action.
         | 
| saas_cookie | Specifies whether to use a CNAME chain to determine the hostname for the SaaS dynamic fail action.
         | 
| saas_query_string | Specifies the name of the query parameter that identifies this SaaS dynamic fail action.
         | 
| saas_regex | Specifies the substitution pattern (a Perl-compatible regular expression) that defines the SaaS dynamic fail action.
         | 
| saas_replace | Specifies the replacement pattern that defines the SaaS dynamic fail action.
         | 
| saas_suffix | Specifies the static portion of the SaaS dynamic fail action.
         | 
| dynamic_method | Specifies the redirect method. Value is one of:
           
 | 
| dynamic_custom_path | Allows you to modify the original requested path.
         | 
| dynamic_path | Specifies the new path.
         | 
| redirect_hostname_type | Whether to preserve or customize the hostname. Value is one of:
           
 | 
| redirect_hostname | When the  action_typeisREDIRECTand theredirect_hostname_typeisALTERNATEthis specifies the hostname for the redirect. | 
| redirect_custom_path | Uses the  redirect_pathto customize a new path. | 
| redirect_path | Specifies a new path.
         | 
| redirect_method | Specifies the HTTP response code. Value is one of:
           
 | 
| content_hostname | Specifies the static hostname for the alternate redirect.
         | 
| content_custom_path | Specifies a custom redirect path.
         | 
| content_path | Specifies a custom redirect path.
         | 
| net_storage_hostname | When the  action_typeisRECREATED_NSspecifies the NetStorage origin to serve the alternate content. Contact Akamai Professional Services for your NetStorage origin'sid. Contains:
 | 
| net_storage_path | |
| cex_hostname | Specifies a hostname.
         | 
| cex_custom_path | Specifies a custom path.
         | 
| cex_path | Specifies a custom path.
         | 
| cp_code | Specifies a CP code for which to log errors for the NetStorage location. Contains a CP code  idwithout the prefix. | 
| status_code | Assigns a new HTTP status code to the failure response. Value is one of:
           
 
 
 
 
 | 
| preserve_query_string | When using either  content_custom_path,cex_custom_path,dynamic_custom_path, orredirect_custom_pathto specify a custom path, enabling this passes in the original request's query string as part of the path. | 
| modify_protocol | Modifies the redirect's protocol using the value of the  protocolfield. | 
| protocol | When the  action_typeisREDIRECTandmodify_protocolis enabled, this specifies the redirect's protocol. Value is one of:
 | 
