ALIYUN::ESA::HttpIncomingRequestHeaderModificationRule

更新时间:
复制为 MD 格式

ALIYUN::ESA::HttpIncomingRequestHeaderModificationRule类型用于创建修改HTTP入站请求头配置。

语法

{
  "Type": "ALIYUN::ESA::HttpIncomingRequestHeaderModificationRule",
  "Properties": {
    "RequestHeaderModification": List,
    "SiteId": Integer,
    "RuleEnable": String,
    "Rule": String,
    "RuleName": String,
    "Sequence": Integer,
    "SiteVersion": Integer
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

RequestHeaderModification

List

修改请求头的配置。

您可以添加、删除或修改请求头。更多信息,请参考RequestHeaderModification属性

SiteId

Integer

站点ID。

Rule

String

规则内容,使用条件表达式匹配用户请求。

添加全局配置时,无需设置此参数。有两种使用场景:

- 匹配所有传入请求:将值设置为 true。

- 匹配指定请求:将值设置为自定义表达式,例如: (http.host eq \"video.example.com\").

RuleEnable

String

规则开关。

添加全局配置时,无需设置此参数。取值范围:

- on: 开启。

- off: 关闭。

RuleName

String

规则名称。

添加全局配置时,无需设置此参数。

Sequence

Integer

规则执行顺序。

值越小,执行优先级越高。

SiteVersion

Integer

站点配置的版本号。

对于已启用配置版本管理的站点,可使用此参数指定配置站点的生效版本,默认为版本0。

RequestHeaderModification语法

"RequestHeaderModification": [
  {
    "Type": String,
    "Value": String,
    "Operation": String,
    "Name": String
  }
]

RequestHeaderModification属性

属性名称

类型

必须

允许更新

描述

约束

Name

String

请求头名称。

Operation

String

操作模式。

取值范围:

  • add: 添加。

  • del: 删除

  • modify: 修改。

Type

String

值类型。

取值范围:

  • static:静态模式。

  • dynamic:动态模式。

Value

String

请求头值。

返回值

Fn::GetAtt

  • RuleEnable:规则开关。添加全局配置时,无需设置此参数。

  • Sequence:规则执行顺序。值越小,执行优先级越高。

  • Rule:规则内容,使用条件表达式匹配用户请求。添加全局配置时,无需设置此参数。

  • ConfigId:配置ID。

  • SiteVersion:站点配置的版本号。对于已启用配置版本管理的站点,可使用此参数指定配置站点的生效版本,默认为版本0。

  • ConfigType:配置类型。您可以使用此参数检查全局配置或规则配置。

  • RequestHeaderModification:修改请求头的配置。您可以添加、删除或修改请求头。

  • RuleName:规则名称。添加全局配置时,无需设置此参数。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SiteId:
    Type: Number
    Description:
      en: The site ID.
    Required: true
  RuleEnable:
    Type: String
    Description:
      en: |-
        Rule switch. When adding global configuration, this parameter does not need to be set. Value range:
        - on: open.
        - off: close.
    AllowedValues:
      - 'on'
      - 'off'
    Required: false
  Sequence:
    Type: Number
    Description:
      en: Order of rule execution. The smaller the value, the higher the priority for execution.
    Required: false
  Rule:
    Type: String
    Description:
      en: |-
        Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set. There are two usage scenarios:
        - Match all incoming requests: value set to true
        - Match specified request: Set the value to a custom expression, for example: (http.host eq \"video.example.com\").
    Required: false
  SiteVersion:
    Type: Number
    Description:
      en: The version number of the site configuration. For sites that have enabled configuration version management, this parameter can be used to specify the effective version of the configuration site, which defaults to version 0.
    Required: false
  RequestHeaderModification:
    AssociationPropertyMetadata:
      Parameters:
        Type:
          Type: String
          Description:
            en: |-
              Value type. Value range:
              - `static`:static mode.
              - `dynamic`:dynamic mode.
          AllowedValues:
            - static
            - dynamic
          Required: false
        Value:
          Type: String
          Description:
            en: Request header value.
          Required: false
        Operation:
          Type: String
          Description:
            en: |-
              Mode of operation. Value range:
              - `add`: add.
              - `del`: delete
              - `modify`: change.
          AllowedValues:
            - add
            - del
            - modify
          Required: true
        Name:
          Type: String
          Description:
            en: Request Header Name.
          Required: true
    Type: Json
    AssociationProperty: List[Parameters]
    Description:
      en: The configurations of modifying request headers. You can add, delete, or modify a request header.
    Required: true
  RuleName:
    Type: String
    Description:
      en: Rule name. When adding global configuration, this parameter does not need to be set.
    Required: false
Resources:
  ExtensionResource:
    Type: ALIYUN::ESA::HttpIncomingRequestHeaderModificationRule
    Properties:
      SiteId:
        Ref: SiteId
      RuleEnable:
        Ref: RuleEnable
      Sequence:
        Ref: Sequence
      Rule:
        Ref: Rule
      SiteVersion:
        Ref: SiteVersion
      RequestHeaderModification:
        Ref: RequestHeaderModification
      RuleName:
        Ref: RuleName
Outputs:
  RuleEnable:
    Description: Rule switch. When adding global configuration, this parameter does not need to be set.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RuleEnable
  Sequence:
    Description: Order of rule execution. The smaller the value, the higher the priority for execution.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Sequence
  Rule:
    Description: Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Rule
  ConfigId:
    Description: Config Id.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ConfigId
  SiteVersion:
    Description: The version number of the site configuration. For sites that have enabled configuration version management, this parameter can be used to specify the effective version of the configuration site, which defaults to version 0.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SiteVersion
  ConfigType:
    Description: The configuration type. You can use this parameter to check the global configuration or rule configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ConfigType
  RequestHeaderModification:
    Description: The configurations of modifying request headers. You can add, delete, or modify a request header.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RequestHeaderModification
  RuleName:
    Description: Rule name. When adding global configuration, this parameter does not need to be set.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RuleName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SiteId": {
      "Type": "Number",
      "Description": {
        "en": "The site ID."
      },
      "Required": true
    },
    "RuleEnable": {
      "Type": "String",
      "Description": {
        "en": "Rule switch. When adding global configuration, this parameter does not need to be set. Value range:\n- on: open.\n- off: close."
      },
      "AllowedValues": [
        "on",
        "off"
      ],
      "Required": false
    },
    "Sequence": {
      "Type": "Number",
      "Description": {
        "en": "Order of rule execution. The smaller the value, the higher the priority for execution."
      },
      "Required": false
    },
    "Rule": {
      "Type": "String",
      "Description": {
        "en": "Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set. There are two usage scenarios:\n- Match all incoming requests: value set to true\n- Match specified request: Set the value to a custom expression, for example: (http.host eq \\\"video.example.com\\\")."
      },
      "Required": false
    },
    "SiteVersion": {
      "Type": "Number",
      "Description": {
        "en": "The version number of the site configuration. For sites that have enabled configuration version management, this parameter can be used to specify the effective version of the configuration site, which defaults to version 0."
      },
      "Required": false
    },
    "RequestHeaderModification": {
      "AssociationPropertyMetadata": {
        "Parameters": {
          "Type": {
            "Type": "String",
            "Description": {
              "en": "Value type. Value range:\n- `static`:static mode.\n- `dynamic`:dynamic mode."
            },
            "AllowedValues": [
              "static",
              "dynamic"
            ],
            "Required": false
          },
          "Value": {
            "Type": "String",
            "Description": {
              "en": "Request header value."
            },
            "Required": false
          },
          "Operation": {
            "Type": "String",
            "Description": {
              "en": "Mode of operation. Value range:\n- `add`: add.\n- `del`: delete\n- `modify`: change."
            },
            "AllowedValues": [
              "add",
              "del",
              "modify"
            ],
            "Required": true
          },
          "Name": {
            "Type": "String",
            "Description": {
              "en": "Request Header Name."
            },
            "Required": true
          }
        }
      },
      "Type": "Json",
      "AssociationProperty": "List[Parameters]",
      "Description": {
        "en": "The configurations of modifying request headers. You can add, delete, or modify a request header."
      },
      "Required": true
    },
    "RuleName": {
      "Type": "String",
      "Description": {
        "en": "Rule name. When adding global configuration, this parameter does not need to be set."
      },
      "Required": false
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::ESA::HttpIncomingRequestHeaderModificationRule",
      "Properties": {
        "SiteId": {
          "Ref": "SiteId"
        },
        "RuleEnable": {
          "Ref": "RuleEnable"
        },
        "Sequence": {
          "Ref": "Sequence"
        },
        "Rule": {
          "Ref": "Rule"
        },
        "SiteVersion": {
          "Ref": "SiteVersion"
        },
        "RequestHeaderModification": {
          "Ref": "RequestHeaderModification"
        },
        "RuleName": {
          "Ref": "RuleName"
        }
      }
    }
  },
  "Outputs": {
    "RuleEnable": {
      "Description": "Rule switch. When adding global configuration, this parameter does not need to be set.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RuleEnable"
        ]
      }
    },
    "Sequence": {
      "Description": "Order of rule execution. The smaller the value, the higher the priority for execution.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Sequence"
        ]
      }
    },
    "Rule": {
      "Description": "Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Rule"
        ]
      }
    },
    "ConfigId": {
      "Description": "Config Id.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ConfigId"
        ]
      }
    },
    "SiteVersion": {
      "Description": "The version number of the site configuration. For sites that have enabled configuration version management, this parameter can be used to specify the effective version of the configuration site, which defaults to version 0.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SiteVersion"
        ]
      }
    },
    "ConfigType": {
      "Description": "The configuration type. You can use this parameter to check the global configuration or rule configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ConfigType"
        ]
      }
    },
    "RequestHeaderModification": {
      "Description": "The configurations of modifying request headers. You can add, delete, or modify a request header.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RequestHeaderModification"
        ]
      }
    },
    "RuleName": {
      "Description": "Rule name. When adding global configuration, this parameter does not need to be set.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RuleName"
        ]
      }
    }
  }
}