All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ESA::CustomResponseCodeRule

Last Updated:Jul 05, 2026

The ALIYUN::ESA::CustomResponseCodeRule resource creates a custom response code rule for a site.

Syntax

{
  "Type": "ALIYUN::ESA::CustomResponseCodeRule",
  "Properties": {
    "PageId": String,
    "ReturnCode": String,
    "SiteId": Integer,
    "RuleEnable": String,
    "Rule": String,
    "RuleName": String,
    "Sequence": Integer,
    "SiteVersion": Integer
  }
}

Properties

Parameter

Type

Required

Editable

Description

Constraints

PageId

String

Yes

Yes

The custom response page.

None

ReturnCode

String

Yes

Yes

The custom response code.

None

SiteId

Integer

Yes

No

The site ID.

None

Rule

String

No

Yes

A conditional expression that matches user requests.

This parameter is optional for a global configuration. Examples:

- To match all incoming requests, set the value to true.

- To match a specific request, set the value to a custom expression, such as (http.host eq "video.example.com").

RuleEnable

String

No

Yes

Indicates whether the rule is enabled.

This parameter is optional for a global configuration. Valid values:

- on: The rule is enabled.

- off: The rule is disabled.

RuleName

String

No

Yes

The rule name.

This parameter is optional for a global configuration.

Sequence

Integer

No

Yes

The execution priority of the rule.

A smaller value indicates a higher execution priority.

SiteVersion

Integer

No

No

The version number of the site configuration.

If version management is enabled for the site, use this parameter to specify the effective version of the configuration. The default is 0.

Return values

When you pass the logical ID of this resource to the Fn::GetAtt intrinsic function, Fn::GetAtt returns a value for the specified attribute. The following attributes are available:

  • PageId: The custom response page.

  • ReturnCode: The custom response code.

  • RuleEnable: Indicates whether the rule is enabled. This attribute is not returned for a global configuration.

  • Sequence: The execution priority of the rule. A smaller value indicates a higher execution priority.

  • Rule: The rule's conditional expression. This attribute is not returned for a global configuration.

  • ConfigId: The config ID.

  • SiteVersion: The version number of the site configuration.

  • ConfigType: The configuration type. Use this attribute to determine if the configuration is global or rule-based.

  • RuleName: The name of the rule. This attribute is not returned for a global configuration.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  PageId:
    Type: String
    Description:
      en: The custom response page.
    Required: true
  SiteId:
    Type: Number
    Description:
      en: The site ID.
    Required: true
  ReturnCode:
    Type: String
    Description:
      en: The custom response code.
    Required: true
  RuleEnable:
    Type: String
    Description:
      en: |-
        Indicates whether the rule is enabled. This parameter is optional for a global configuration.
        Valid values:
        - on: The rule is enabled.
        - off: The rule is disabled.
    AllowedValues:
      - 'on'
      - 'off'
    Required: false
  Sequence:
    Type: Number
    Description:
      en: The execution priority of the rule. A smaller value indicates a higher execution priority.
    Required: false
  Rule:
    Type: String
    Description:
      en: |-
        A conditional expression that matches user requests. This parameter is optional for a global configuration. Examples:
        - To match all incoming requests, set the value to true.
        - To match a specific request, set the value to a custom expression, such as (http.host eq "video.example.com").
    Required: false
  SiteVersion:
    Type: Number
    Description:
      en: The version number of the site configuration. If version management is enabled for the site, use this parameter to specify the effective version of the configuration. The default is 0.
    Required: false
  RuleName:
    Type: String
    Description:
      en: The rule name. This parameter is optional for a global configuration.
    Required: false
Resources:
  ExtensionResource:
    Type: ALIYUN::ESA::CustomResponseCodeRule
    Properties:
      PageId:
        Ref: PageId
      SiteId:
        Ref: SiteId
      ReturnCode:
        Ref: ReturnCode
      RuleEnable:
        Ref: RuleEnable
      Sequence:
        Ref: Sequence
      Rule:
        Ref: Rule
      SiteVersion:
        Ref: SiteVersion
      RuleName:
        Ref: RuleName
Outputs:
  PageId:
    Description: The custom response page.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - PageId
  ReturnCode:
    Description: The custom response code.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ReturnCode
  RuleEnable:
    Description: Indicates whether the rule is enabled. This attribute is not returned for a global configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RuleEnable
  Sequence:
    Description: The execution priority of the rule. A smaller value indicates a higher execution priority.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Sequence
  Rule:
    Description: The rule's conditional expression. This attribute is not returned for a global configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Rule
  ConfigId:
    Description: The config ID.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ConfigId
  SiteVersion:
    Description: The version number of the site configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SiteVersion
  ConfigType:
    Description: The configuration type. Use this attribute to determine if the configuration is global or rule-based.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ConfigType
  RuleName:
    Description: The name of the rule. This attribute is not returned for a global configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RuleName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "PageId": {
      "Type": "String",
      "Description": {
        "en": "The custom response page."
      },
      "Required": true
    },
    "SiteId": {
      "Type": "Number",
      "Description": {
        "en": "The site ID."
      },
      "Required": true
    },
    "ReturnCode": {
      "Type": "String",
      "Description": {
        "en": "The custom response code."
      },
      "Required": true
    },
    "RuleEnable": {
      "Type": "String",
      "Description": {
        "en": "Indicates whether the rule is enabled. This parameter is optional for a global configuration.\nValid values:\n- on: The rule is enabled.\n- off: The rule is disabled."
      },
      "AllowedValues": [
        "on",
        "off"
      ],
      "Required": false
    },
    "Sequence": {
      "Type": "Number",
      "Description": {
        "en": "The execution priority of the rule. A smaller value indicates a higher execution priority."
      },
      "Required": false
    },
    "Rule": {
      "Type": "String",
      "Description": {
        "en": "A conditional expression that matches user requests. This parameter is optional for a global configuration. Examples:\n- To match all incoming requests, set the value to true.\n- To match a specific request, set the value to a custom expression, such as (http.host eq \\\"video.example.com\\\")."
      },
      "Required": false
    },
    "SiteVersion": {
      "Type": "Number",
      "Description": {
        "en": "The version number of the site configuration. If version management is enabled for the site, use this parameter to specify the effective version of the configuration. The default is 0."
      },
      "Required": false
    },
    "RuleName": {
      "Type": "String",
      "Description": {
        "en": "The rule name. This parameter is optional for a global configuration."
      },
      "Required": false
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::ESA::CustomResponseCodeRule",
      "Properties": {
        "PageId": {
          "Ref": "PageId"
        },
        "SiteId": {
          "Ref": "SiteId"
        },
        "ReturnCode": {
          "Ref": "ReturnCode"
        },
        "RuleEnable": {
          "Ref": "RuleEnable"
        },
        "Sequence": {
          "Ref": "Sequence"
        },
        "Rule": {
          "Ref": "Rule"
        },
        "SiteVersion": {
          "Ref": "SiteVersion"
        },
        "RuleName": {
          "Ref": "RuleName"
        }
      }
    }
  },
  "Outputs": {
    "PageId": {
      "Description": "The custom response page.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PageId"
        ]
      }
    },
    "ReturnCode": {
      "Description": "The custom response code.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ReturnCode"
        ]
      }
    },
    "RuleEnable": {
      "Description": "Indicates whether the rule is enabled. This attribute is not returned for a global configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RuleEnable"
        ]
      }
    },
    "Sequence": {
      "Description": "The execution priority of the rule. A smaller value indicates a higher execution priority.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Sequence"
        ]
      }
    },
    "Rule": {
      "Description": "The rule's conditional expression. This attribute is not returned for a global configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Rule"
        ]
      }
    },
    "ConfigId": {
      "Description": "The config ID.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ConfigId"
        ]
      }
    },
    "SiteVersion": {
      "Description": "The version number of the site configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SiteVersion"
        ]
      }
    },
    "ConfigType": {
      "Description": "The configuration type. Use this attribute to determine if the configuration is global or rule-based.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ConfigType"
        ]
      }
    },
    "RuleName": {
      "Description": "The name of the rule. This attribute is not returned for a global configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RuleName"
        ]
      }
    }
  }
}