全部产品
Search
文档中心

资源编排:ALIYUN::GA::ForwardingRules

更新时间:Dec 03, 2024

ALIYUN::GA::ForwardingRules类型用于创建转发规则。

语法

{
  "Type": "ALIYUN::GA::ForwardingRules",
  "Properties": {
    "AcceleratorId": String,
    "ForwardingRules": List,
    "ListenerId": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

AcceleratorId

String

全球加速实例 ID。

ForwardingRules

List

转发策略配置信息列表。

更多信息,请参见ForwardingRules属性。

ListenerId

String

监听实例 ID。

ForwardingRules语法

"ForwardingRules": [
  {
    "RuleActions": List,
    "Priority": Integer,
    "ForwardingRuleName": String,
    "RuleConditions": List,
    "RuleDirection": String
  }
]

ForwardingRules属性

属性名称

类型

必须

允许更新

描述

约束

RuleActions

List

转发动作配置列表。

更多信息,请参见RuleActions属性。

RuleConditions

List

转发条件列表。

更多信息,请参见RuleConditions属性。

ForwardingRuleName

String

转发策略名称。

长度为 2~128 个英文或中文字符,必须以大小写字母或中文开头,可包含数字、半角句号(.)、下划线(_)和短划线(-)。

Priority

Integer

转发策略优先级。

取值范围:1~10000。值越小表示优先级越高。

RuleDirection

String

规则生效方向。

目前默认为request,表示请求方向生效。

RuleActions语法

"RuleActions": [
  {
    "RuleActionType": String,
    "Order": Integer,
    "RuleActionValue": String
  }
]

RuleActions属性

属性名称

类型

必须

允许更新

描述

约束

Order

Integer

转发优先级。

RuleActionType

String

转发动作类型。

取值:

  • ForwardGroup:转发。

  • Redirect:重定向。

  • FixResponse:返回固定响应。

  • Rewrite:重写。

  • AddHeader:写入头字段。

  • RemoveHeader:删除头字段。

  • Drop:丢弃。

RuleActionValue

String

转发动作类型对应的值。

根据RuleActionType传入不同的 JSON 字符串值。

一个转发规则最多只能有一条ForwardGroupRedirectFixResponse类型的转发动作。RewriteAddHeaderRemoveHeader类型的转发动作顺序必须在ForwardGroup类型的转发动作之前。

  • RuleActionType取值为ForwardGroup时,该参数为虚拟终端节点组信息。仅支持转发至一个虚拟终端节点组。取值样例为{"type":"endpointgroup", "value":"epg-bp1enpdcrqhl78g6r****"},其中:

    • type:取值为endpointgroup

    • value:目标虚拟终端节点组 ID。

  • RuleActionType取值为Redirect时,该参数为重定向配置信息。Redirect类型的转发动作中protocoldomainportpathquery不能全部为空或者默认值。取值样例为{"protocol":"HTTP", "domain":"www.example.com", "port":"80", "path":"/a","query":"value1", "code":"301" },其中:

    • protocol:要跳转的协议。取值范围为${protocol}(默认值)、HTTPHTTPS

    • domain:要跳转的域名。默认值为${host}(默认值),您还可以输入其他域名信息,域名长度为 3~128 个字符,只允许包含小写字母、数字和特殊字符.-?=~_-+/^*!$&()[]

    • port:要跳转的端口。默认值为${port},您还可以输入端口号,端口取值范围为 1~63335。

    • path:要跳转的路径。默认值为${path},路径长度限制为 1~128 个字符。正则表达式类型的路径,必须以波浪线(~)开头,支持的大小写字母、数字和特殊字符.-_/=?~^*$:()[]+;非正则表达式类型的路径,必须以正斜线(/) 开头,支持大小写字母、数字和特殊字符.-_/=?:

    • query:要跳转的查询字符串。默认值为${query},您还可以输入其他查询字符串信息,查询字符串长度为 1~128 个字符,支持 ASCII 码值ch >= 32 && ch < 127范围内可打印字符,如果是字母必须为小写字母,不支持空格和特殊字符[]{}<>\#&

    • code:跳转方式。支持301302303307308

  • RuleActionType取值为FixResponse时,该参数为返回固定响应配置信息。取值样例为{"code":"200", "type":"text/plain", "content":"dssacav" },其中:

    • code:响应状态码。仅支持2xx4xx5xx数字型字符串,x为任意数字。

    • type:响应正文类型。仅支持text/plaintext/csstext/htmlapplication/javascriptapplication/json

    • content:响应正文。响应正文长度不能超过 1000 个字符,不支持中文字符。

  • RuleActionType取值为AddHeader时,该参数为插入 HTTP 标头字段配置信息。转发规则中存在AddHeader类型的转发动作,必须同时配置一条ForwardGroup类型的转发动作。取值样例为[{"name":"header1","type":"userdefined", "value":"value"}],其中:

    • name:HTTP 标头字段名称。名称长度为 1~40 字符,支持大小写字母、数字、短划线(-)和下划线(_)。AddHeader中的 HTTP 标头字段名称不能重复,也不能和RemoveHeader中的 HTTP 标头字段名称重复。

    • type:HTTP 标头字段内容类型。取值范围为user-defined(用户指定)、ref(引用)、system-defined(系统定义)。

    • value:HTTP 标头字段内容,内容不能为空。typeuser-defined(用户指定)时,长度为 1~128 个字符,支持 ASCII 码值ch >= 32 && ch < 127范围内的可打印字符,支持大小写字母、数字、短划线(-)和下划线(),开头和结尾不能为空格;typeref(引用)时,长度为 1~128 个字符,支持大小写字母、数字、短划线(-)和下划线(),开头和结尾不能为空格;typesystem-defined(系统定义)时,仅支持取值为ClientSrcIp

  • RuleActionType取值为RemoveHeader时,该参数为删除 HTTP 标头字段信息。转发规则中存在RemoveHeader类型的转发动作,必须同时配置一条ForwardGroup类型的转发动作。长度为 1~40 字符,支持大小写字母、数字、短划线(-)和下划线(_)。取值样例为["header1"]

  • RuleActionType取值为Rewrite时,该参数为重写配置信息。转发规则中存在Rewrite类型的转发动作,必须同时配置一条ForwardGroup类型的转发动作。取值样例为{"domain":"value1", "path":"value2", "query":"value3"},其中:

    • domain:要跳转的域名。默认值为${host},您还可以输入其他域名信息,域名长度为 3~128 个字符,只允许包含小写字母、数字和特殊字符.-?=~_-+/^*!$&()[]

    • path:要跳转的路径。默认值为${path},路径长度限制为 1~128 个字符。正则表达式类型的路径,必须以波浪线(~)开头,支持的大小写字母、数字和特殊字符.-_/=?~^*$:()[]+;非正则表达式类型的路径,必须以正斜线(/) 开头,支持大小写字母、数字和特殊字符.-_/=?:

    • query:要跳转的查询字符串。默认值为${query},您还可以输入其他查询字符串信息,查询字符串长度为 1~128 个字符,支持 ASCII 码值ch >= 32 && ch < 127范围内可打印字符,如果是字母必须为小写字母,不支持空格和特殊字符[]{}<>\#&

  • RuleActionType取值为Drop时,该参数无需填写。

RuleConditions语法

"RuleConditions": [
  {
    "RuleConditionType": String,
    "RuleConditionValue": String
  }
]

RuleConditions属性

属性名称

类型

必须

允许更新

描述

约束

RuleConditionType

String

转发条件类型。

取值:

  • Host:域名。

  • Path:路径。

  • RequestHeader:HTTP 标头。

  • Query:查询字符串。

  • Method:HTTP 请求方法。

  • Cookie:Cookie。

  • SourceIP:源 IP。

RuleConditionValue

String

转发条件类型对应的值。

根据RuleConditionType传入不同的 JSON 字符串值。

  • RuleConditionType取值为Host时,该参数为域名条件配置信息。一个转发策略内只允许创建一个域名类型转发规则,该转发规则内支持配置多个域名,多个域名间为“或”关系。域名长度为 3~128 个字符,允许包含字母、数字、短划线(-)和半角句号(.),支持使用星号(*)和半角问号(?)作为通配符。取值样例为["www.example.com", "www.aliyun.com"]

  • RuleConditionType取值为Path时,该参数为路径条件配置信息。一个转发策略内允许创建多个路径类型转发规则,多个路径类型转发规则间为“或”关系,一个转发路径类型规则内支持配置多个路径,多个路径间为“或”关系。路径长度为 1~128 个字符,必须以正斜线(/)开头,只允许包含字母、数字、美元符号($)、短划线(-)、下划线(_)、半角句号(.)、加号(+)、正斜线(/)、and(&)、波浪线(~)、at(@)、半角冒号(:)、撇号('),支持使用星号(*)和半角问号(?)作为通配符。取值样例为["/a", "/b/"]

  • RuleConditionType取值为RequestHeader时,该参数为 HTTP 标头字段条件配置信息,由键(Key)和值(Value)组成。同一个转发规则条件内标头字段值不能重复。取值样例为[{"header1":["value1","value2"]}]

    • Key:HTTP 标头的键值长度为 1~40 个字符,支持字母、数字、短划线(-)和下划线(_)。

    • Value:HTTP 标头的值长度为 1~128 个字符,支持 ASCII 码值ch >= 32 && ch < 127范围内可打印字符,开头和结尾不能为空格。

  • RuleConditionType取值为Query时,该参数为查询字符串条件配置信息,由键(Key)和值(Value)组成。取值样例为[{"query1":["value1"]}, {"query2":["value2"]}]

    • Key:HTTP 标头的键值长度为 1~100 个字符,支持 ASCII 码值ch >= 32 && ch < 127范围内可打印字符,如果是字母必须为小写字母,不支持空格和[]{}<>\;/?:@&=+,$%"^~

    • Value:HTTP 标头的值长度为 1~128 个字符,支持 ASCII 码值ch >= 32 && ch < 127范围内可打印字符,如果是字母必须为小写字母,不支持空格和[]{}<>\;/?:@&=+,$%"^~

  • RuleConditionType取值为Method时,该参数为请求方法配置信息。取值范围为HEADGETPOSTOPTIONSPUTPATCHDELETE。取值样例为["GET", "OPTIONS", "POST"]

  • RuleConditionType取值为Cookie时,该参数为 Cookie 配置信息,由键(Key)和值(Value)组成。取值样例为[{"cookie1":["value1"]}, {"cookie2":["value2"]}]

    • Key:Cookie 的键值长度为 1~100 个字符,支持 ASCII 码值ch >= 32 && ch < 127范围内可打印字符,如果是字母必须为小写字母,不支持空格和#[]{}\<>&

    • Value:Cookie 的值长度为 1~128 个字符,支持 ASCII 码值ch >= 32 && ch < 127范围内可打印字符,如果是字母必须为小写字母,不支持空格和#[]{}\<>&

  • RuleConditionType取值为SourceIP时,该参数为源 IP 配置信息,支持 IP 地址,例如 1.1.XX.XX/32,或 IP 地址段,例如 2.2.XX.XX/24。一个转发规则只允许创建一个源 IP 规则,该转发规则内支持配置多个源 IP,多个 IP 之间为“或”关系。取值样例为["1.1.XX.XX/32", "2.2.XX.XX/24"]

返回值

Fn::GetAtt

ForwardingRuleIds:转发策略IDs。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  AcceleratorId:
    Type: String
    Description:
      en: The ID of the GA instance.
    Required: true
  ForwardingRules:
    AssociationPropertyMetadata:
      Parameter:
        AssociationPropertyMetadata:
          Parameters:
            RuleActions:
              AssociationPropertyMetadata:
                Parameters:
                  RuleActionType:
                    Type: String
                    Description:
                      en: |
                        The type of the forwarding action. Valid values:
                        * ForwardGroup: forwards a request.
                        * Redirect: redirects a request.
                        * FixResponse: returns a fixed response. 
                        * Rewrite: rewrites a request. 
                        * AddHeader: adds a header to a request. 
                        * RemoveHeaderConfig: deletes the header from a request. 
                    AllowedValues:
                      - ForwardGroup
                      - Redirect
                      - FixResponseRewrite
                      - AddHeaderRemoveHeaderConfig
                    Required: true
                  Order:
                    Type: Number
                    Description:
                      en: The forwarding priority.
                    Required: true
                  RuleActionValue:
                    Type: String
                    Description:
                      en: |-
                        The value of the forwarding action type. You must specify different JSON strings based on the RuleActionType parameter. A forwarding rule can contain only one forwarding action whose type is ForwardGroup, Redirect, or FixResponse. You must specify a forwarding action whose type is Rewrite, AddHeader, or RemoveHeader before a forwarding action whose type is ForwardGroup. 
                        * If RuleActionType is set to ForwardGroup, this parameter specifies the information of a virtual endpoint group. You can forward requests to only one virtual endpoint group. Example: {"type":"endpointgroup", "value":"epg-bp1enpdcrqhl78g6r****"}. 
                          * type: set this parameter to endpointgroup.
                          * value: set this parameter to the ID of a virtual endpoint group.
                        * If RuleActionType is set to Redirect, this parameter specifies redirecting configurations. You cannot leave all of the following parameters empty or configure all of these parameters to use the default values for a forwarding action whose type is Redirect: protocol, domain, port, path, and query. Example: {"protocol":"HTTP", "domain":"www.example.com", "port":"80", "path":"/a","query":"value1", "code":"301" }.
                          * protocol: the protocol of requests after the requests are redirected. Valid values: ${protocol} (default), HTTP, and HTTPS.
                          * domain: the domain name to which requests are redirected. Default value: ${host}. You can also enter a domain name. The domain name must be 3 to 128 characters in length, and can contain only letters, digits, and the following special characters: . - ? = ~ _ - + / ^ * ! $ & | ( ) [ ].
                          * port: the port to which requests are redirected. Default value: ${port}. You can enter a port number that ranges from 1 to 63335.
                          * path: the path to which requests are redirected. Default value: ${path}. The path must be 1 to 128 characters in length. To use a regular expression, the path can contain letters, digits, and the following special characters: . - _ / = ? ~ ^ * $ : ( ) [ ] + |. The path must start with a tilde (~). If you do not want to use a regular expression, the path can contain letters, digits, and the following special characters: . - _ / = ? :. The path must start with a forward slash (/).
                          * query: the query string of the requests to be redirected. Default value: ${query}. You can also specify a query string. The query string must be 1 to 128 characters in length, and can contain printable characters whose ASCII values are greater than or equal to 32 and smaller than 127. The query string cannot contain uppercase letters, space characters, or the following special characters: [ ] { } < > # | &.
                          * code: the redirecting code. Valid values: 301, 302, 303, 307, and 308.
                        * If RuleActionType is set to FixResponse, this parameter specifies a fixed response. Example: {"code":"200", "type":"text/plain", "content":"dssacav" }.
                          * code: the HTTP status code to return. The response status code must be one of the following numeric strings: 2xx, 4xx, and 5xx. The letter x indicates a number from 0 to 9.
                          * type: the type of the response content. Valid values: text/plain, text/css, text/html, application/javascript, and application/json.
                          * content: the response content. The response content cannot exceed 1,000 characters in length and does not support Chinese characters.
                        * If RuleActionType is set to AddHeader, this parameter specifies an HTTP header to be added. If a forwarding rule contains a forwarding action whose type is AddHeader, you must specify another forwarding action whose type is ForwardGroup. Example: [{"name":"header1","type":"userdefined", "value":"value"}].
                          * name: the name of the HTTP header. The name must be 1 to 40 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). The name of the HTTP header specified by AddHeader must be unique and cannot be the same as the name of the HTTP header specified by RemoveHeader.
                          * type: the content type of the HTTP header. Valid values: user-defined, ref, and system-defined.
                          * value: the content of the HTTP header. You cannot leave this parameter empty. If you set type to user-defined, the content must be 1 to 128 characters in length, and can contain printable characters whose ASCII values are greater than or equal to 32 and smaller than 127. The content can contain letters, digits, hyphens (-), and underscores (_). The content cannot start or end with a space character. If you set type to ref, the content must be 1 to 128 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). The content cannot start or end with a space character. If you set type to system-defined, only ClientSrcIp is supported.
                        * If RuleActionType is set to RemoveHeader, this parameter specifies an HTTP header to be removed. If a forwarding rule contains a forwarding action whose type is RemoveHeader, you must specify another forwarding action whose type is ForwardGroup. The header must be 1 to 40 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). Example: ["header1"].
                        * If RuleActionType is set to Rewrite, this parameter specifies the rewriting configuration. If a forwarding rule contains a forwarding action whose type is Rewrite, you must specify another forwarding action whose type is ForwardGroup. Example: {"domain":"value1", "path":"value2", "query":"value3"}.
                          * domain: the domain name to which requests are redirected. Default value: ${host}. You can also enter a domain name. The domain name must be 3 to 128 characters in length, and can contain only lowercase letters, digits, and the following special characters: . - ? = ~ _ - + / ^ * ! $ & | ( ) [ ].
                          * path: the path to which requests are redirected. Default value: ${path}. The path must be 1 to 128 characters in length. To use a regular expression, the path can contain letters, digits, and the following special characters: . - _ / = ? ~ ^ * $ : ( ) [ ] + |. The path must start with a tilde (~). If you do not want to use a regular expression, the path can contain letters, digits, and the following special characters: . - _ / = ? :. The path must start with a forward slash (/).
                          * query: the query string of the requests to be redirected. Default value: ${query}. You can also specify a query string. The query string must be 1 to 128 characters in length, and can contain printable characters whose ASCII values are greater than or equal to 32 and smaller than 127. The query string cannot contain uppercase letters, space characters, or the following special characters: [ ] { } < > # | &.
                    Required: false
              AssociationProperty: List[Parameters]
              Type: Json
              Description:
                en: The forwarding action.
              Required: true
              MinLength: 1
              MaxLength: 100
            Priority:
              Type: Number
              Description:
                en: 'The priority of the forwarding rule. Valid values: 1 to 10000. A lower value indicates a higher priority.'
              Required: false
              MinValue: 1
              MaxValue: 10000
            ForwardingRuleName:
              Type: String
              Description:
                en: The name of the forwarding rule. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.
              Required: false
              MinLength: 2
              MaxLength: 128
            RuleConditions:
              AssociationPropertyMetadata:
                Parameters:
                  RuleConditionType:
                    Type: String
                    Description:
                      en: |-
                        The type of the forwarding conditions. Valid values:
                        * Host: domain name
                        * Path: path
                        * RequestHeader: HTTP header
                        * Query: query string
                        * Method: HTTP method
                        * Cookie: cookie
                        * SourceIP: source IP address
                    AllowedValues:
                      - Host
                      - Path
                      - RequestHeader
                      - Query
                      - Method
                      - Cookie
                      - SourceIP
                    Required: false
                  RuleConditionValue:
                    Type: String
                    Description:
                      en: The endpoint port that is mapped to the listener port.
                    Required: false
              AssociationProperty: List[Parameters]
              Type: Json
              Description:
                en: The forwarding conditions.
              Required: true
              MinLength: 1
              MaxLength: 100
            RuleDirection:
              Type: String
              Description:
                en: The direction in which the rule takes effect. You do not need to set this parameter. By default, this parameter is set to request, which indicates that the rule takes effect on requests.
              AllowedValues:
                - request
              Required: false
        Type: Json
        Required: false
    AssociationProperty: List[Parameter]
    Type: Json
    Description:
      en: Details about the forwarding rules.
    Required: true
    MinLength: 1
    MaxLength: 200
  ListenerId:
    Type: String
    Description:
      en: The ID of the listener.
    Required: true
Resources:
  ExtensionResource:
    Type: ALIYUN::GA::ForwardingRules
    Properties:
      AcceleratorId:
        Ref: AcceleratorId
      ForwardingRules:
        Ref: ForwardingRules
      ListenerId:
        Ref: ListenerId
Outputs:
  ForwardingRuleIds:
    Description: The IDs of the endpoint groups.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ForwardingRuleIds
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "AcceleratorId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the GA instance."
      },
      "Required": true
    },
    "ForwardingRules": {
      "AssociationPropertyMetadata": {
        "Parameter": {
          "AssociationPropertyMetadata": {
            "Parameters": {
              "RuleActions": {
                "AssociationPropertyMetadata": {
                  "Parameters": {
                    "RuleActionType": {
                      "Type": "String",
                      "Description": {
                        "en": "The type of the forwarding action. Valid values:\n* ForwardGroup: forwards a request.\n* Redirect: redirects a request.\n* FixResponse: returns a fixed response. \n* Rewrite: rewrites a request. \n* AddHeader: adds a header to a request. \n* RemoveHeaderConfig: deletes the header from a request. \n"
                      },
                      "AllowedValues": [
                        "ForwardGroup",
                        "Redirect",
                        "FixResponseRewrite",
                        "AddHeaderRemoveHeaderConfig"
                      ],
                      "Required": true
                    },
                    "Order": {
                      "Type": "Number",
                      "Description": {
                        "en": "The forwarding priority."
                      },
                      "Required": true
                    },
                    "RuleActionValue": {
                      "Type": "String",
                      "Description": {
                        "en": "The value of the forwarding action type. You must specify different JSON strings based on the RuleActionType parameter. A forwarding rule can contain only one forwarding action whose type is ForwardGroup, Redirect, or FixResponse. You must specify a forwarding action whose type is Rewrite, AddHeader, or RemoveHeader before a forwarding action whose type is ForwardGroup. \n* If RuleActionType is set to ForwardGroup, this parameter specifies the information of a virtual endpoint group. You can forward requests to only one virtual endpoint group. Example: {\"type\":\"endpointgroup\", \"value\":\"epg-bp1enpdcrqhl78g6r****\"}. \n  * type: set this parameter to endpointgroup.\n  * value: set this parameter to the ID of a virtual endpoint group.\n* If RuleActionType is set to Redirect, this parameter specifies redirecting configurations. You cannot leave all of the following parameters empty or configure all of these parameters to use the default values for a forwarding action whose type is Redirect: protocol, domain, port, path, and query. Example: {\"protocol\":\"HTTP\", \"domain\":\"www.example.com\", \"port\":\"80\", \"path\":\"/a\",\"query\":\"value1\", \"code\":\"301\" }.\n  * protocol: the protocol of requests after the requests are redirected. Valid values: ${protocol} (default), HTTP, and HTTPS.\n  * domain: the domain name to which requests are redirected. Default value: ${host}. You can also enter a domain name. The domain name must be 3 to 128 characters in length, and can contain only letters, digits, and the following special characters: . - ? = ~ _ - + / ^ * ! $ & | ( ) [ ].\n  * port: the port to which requests are redirected. Default value: ${port}. You can enter a port number that ranges from 1 to 63335.\n  * path: the path to which requests are redirected. Default value: ${path}. The path must be 1 to 128 characters in length. To use a regular expression, the path can contain letters, digits, and the following special characters: . - _ / = ? ~ ^ * $ : ( ) [ ] + |. The path must start with a tilde (~). If you do not want to use a regular expression, the path can contain letters, digits, and the following special characters: . - _ / = ? :. The path must start with a forward slash (/).\n  * query: the query string of the requests to be redirected. Default value: ${query}. You can also specify a query string. The query string must be 1 to 128 characters in length, and can contain printable characters whose ASCII values are greater than or equal to 32 and smaller than 127. The query string cannot contain uppercase letters, space characters, or the following special characters: [ ] { } < > # | &.\n  * code: the redirecting code. Valid values: 301, 302, 303, 307, and 308.\n* If RuleActionType is set to FixResponse, this parameter specifies a fixed response. Example: {\"code\":\"200\", \"type\":\"text/plain\", \"content\":\"dssacav\" }.\n  * code: the HTTP status code to return. The response status code must be one of the following numeric strings: 2xx, 4xx, and 5xx. The letter x indicates a number from 0 to 9.\n  * type: the type of the response content. Valid values: text/plain, text/css, text/html, application/javascript, and application/json.\n  * content: the response content. The response content cannot exceed 1,000 characters in length and does not support Chinese characters.\n* If RuleActionType is set to AddHeader, this parameter specifies an HTTP header to be added. If a forwarding rule contains a forwarding action whose type is AddHeader, you must specify another forwarding action whose type is ForwardGroup. Example: [{\"name\":\"header1\",\"type\":\"userdefined\", \"value\":\"value\"}].\n  * name: the name of the HTTP header. The name must be 1 to 40 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). The name of the HTTP header specified by AddHeader must be unique and cannot be the same as the name of the HTTP header specified by RemoveHeader.\n  * type: the content type of the HTTP header. Valid values: user-defined, ref, and system-defined.\n  * value: the content of the HTTP header. You cannot leave this parameter empty. If you set type to user-defined, the content must be 1 to 128 characters in length, and can contain printable characters whose ASCII values are greater than or equal to 32 and smaller than 127. The content can contain letters, digits, hyphens (-), and underscores (_). The content cannot start or end with a space character. If you set type to ref, the content must be 1 to 128 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). The content cannot start or end with a space character. If you set type to system-defined, only ClientSrcIp is supported.\n* If RuleActionType is set to RemoveHeader, this parameter specifies an HTTP header to be removed. If a forwarding rule contains a forwarding action whose type is RemoveHeader, you must specify another forwarding action whose type is ForwardGroup. The header must be 1 to 40 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). Example: [\"header1\"].\n* If RuleActionType is set to Rewrite, this parameter specifies the rewriting configuration. If a forwarding rule contains a forwarding action whose type is Rewrite, you must specify another forwarding action whose type is ForwardGroup. Example: {\"domain\":\"value1\", \"path\":\"value2\", \"query\":\"value3\"}.\n  * domain: the domain name to which requests are redirected. Default value: ${host}. You can also enter a domain name. The domain name must be 3 to 128 characters in length, and can contain only lowercase letters, digits, and the following special characters: . - ? = ~ _ - + / ^ * ! $ & | ( ) [ ].\n  * path: the path to which requests are redirected. Default value: ${path}. The path must be 1 to 128 characters in length. To use a regular expression, the path can contain letters, digits, and the following special characters: . - _ / = ? ~ ^ * $ : ( ) [ ] + |. The path must start with a tilde (~). If you do not want to use a regular expression, the path can contain letters, digits, and the following special characters: . - _ / = ? :. The path must start with a forward slash (/).\n  * query: the query string of the requests to be redirected. Default value: ${query}. You can also specify a query string. The query string must be 1 to 128 characters in length, and can contain printable characters whose ASCII values are greater than or equal to 32 and smaller than 127. The query string cannot contain uppercase letters, space characters, or the following special characters: [ ] { } < > # | &."
                      },
                      "Required": false
                    }
                  }
                },
                "AssociationProperty": "List[Parameters]",
                "Type": "Json",
                "Description": {
                  "en": "The forwarding action."
                },
                "Required": true,
                "MinLength": 1,
                "MaxLength": 100
              },
              "Priority": {
                "Type": "Number",
                "Description": {
                  "en": "The priority of the forwarding rule. Valid values: 1 to 10000. A lower value indicates a higher priority."
                },
                "Required": false,
                "MinValue": 1,
                "MaxValue": 10000
              },
              "ForwardingRuleName": {
                "Type": "String",
                "Description": {
                  "en": "The name of the forwarding rule. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter."
                },
                "Required": false,
                "MinLength": 2,
                "MaxLength": 128
              },
              "RuleConditions": {
                "AssociationPropertyMetadata": {
                  "Parameters": {
                    "RuleConditionType": {
                      "Type": "String",
                      "Description": {
                        "en": "The type of the forwarding conditions. Valid values:\n* Host: domain name\n* Path: path\n* RequestHeader: HTTP header\n* Query: query string\n* Method: HTTP method\n* Cookie: cookie\n* SourceIP: source IP address"
                      },
                      "AllowedValues": [
                        "Host",
                        "Path",
                        "RequestHeader",
                        "Query",
                        "Method",
                        "Cookie",
                        "SourceIP"
                      ],
                      "Required": false
                    },
                    "RuleConditionValue": {
                      "Type": "String",
                      "Description": {
                        "en": "The endpoint port that is mapped to the listener port."
                      },
                      "Required": false
                    }
                  }
                },
                "AssociationProperty": "List[Parameters]",
                "Type": "Json",
                "Description": {
                  "en": "The forwarding conditions."
                },
                "Required": true,
                "MinLength": 1,
                "MaxLength": 100
              },
              "RuleDirection": {
                "Type": "String",
                "Description": {
                  "en": "The direction in which the rule takes effect. You do not need to set this parameter. By default, this parameter is set to request, which indicates that the rule takes effect on requests."
                },
                "AllowedValues": [
                  "request"
                ],
                "Required": false
              }
            }
          },
          "Type": "Json",
          "Required": false
        }
      },
      "AssociationProperty": "List[Parameter]",
      "Type": "Json",
      "Description": {
        "en": "Details about the forwarding rules."
      },
      "Required": true,
      "MinLength": 1,
      "MaxLength": 200
    },
    "ListenerId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the listener."
      },
      "Required": true
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::GA::ForwardingRules",
      "Properties": {
        "AcceleratorId": {
          "Ref": "AcceleratorId"
        },
        "ForwardingRules": {
          "Ref": "ForwardingRules"
        },
        "ListenerId": {
          "Ref": "ListenerId"
        }
      }
    }
  },
  "Outputs": {
    "ForwardingRuleIds": {
      "Description": "The IDs of the endpoint groups.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ForwardingRuleIds"
        ]
      }
    }
  }
}