ALIYUN::ESA::RewriteUrlRule

更新时间:
复制为 MD 格式

ALIYUN::ESA::RewriteUrlRule类型用于新增站点的重写URL功能配置。

语法

{
  "Type": "ALIYUN::ESA::RewriteUrlRule",
  "Properties": {
    "SiteId": Integer,
    "QueryString": String,
    "RewriteUriType": String,
    "RuleEnable": String,
    "RewriteQueryStringType": String,
    "Rule": String,
    "RuleName": String,
    "SiteVersion": Integer,
    "Uri": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

SiteId

Integer

站点ID。

QueryString

String

希望将原始请求中的查询字符串重写到的目标查询字符串。

RewriteQueryStringType

String

查询字符串重写类型。

取值范围:

  • static: 静态模式。

  • dynamic: 动态模式。

RewriteUriType

String

URI重写类型。

取值范围:

  • static: 静态模式。

  • dynamic: 动态模式。

Rule

String

规则内容。

使用条件表达式匹配用户请求。添加全局配置时,无需设置此参数。有两种使用场景:

Match all incoming requests: value set to true

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

RuleEnable

String

规则开关。

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

  • on: 开启。

  • off: 关闭。

RuleName

String

规则名称。

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

SiteVersion

Integer

站点配置的版本号。

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

Uri

String

希望将原始请求中的路径重写到的目标URI。

返回值

Fn::GetAtt

  • RewriteUriType:URI重写类型。

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

  • RewriteQueryStringType:查询字符串重写类型。

  • QueryString:希望将原始请求中的查询字符串重写到的目标查询字符串。

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

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

  • ConfigId:配置ID。

  • Uri:希望将原始请求中的路径重写到的目标URI。

  • ConfigType:配置类型。此参数确定是查询全局配置还是特定功能的配置。注意:仅当同时提供functionName参数时,此逻辑才生效。

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

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

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SiteId:
    Type: Number
    Description:
      en: The website ID, which can be obtained by calling the [ListSites](https://www.alibabacloud.com/help/en/doc-detail/2850189.html) operation.
    Required: true
  RewriteUriType:
    Type: String
    Description:
      en: |-
        URI rewrite type. Value range:
        - `static`: Static mode.
        - `dynamic`: Dynamic mode.
    AllowedValues:
      - static
      - dynamic
    Required: false
  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
  RewriteQueryStringType:
    Type: String
    Description:
      en: |-
        Query string rewrite type. Value range:
        - `static`: Static mode.
        - `dynamic`: Dynamic mode.
    AllowedValues:
      - static
      - dynamic
    Required: false
  QueryString:
    Type: String
    Description:
      en: The desired query string to which you want to rewrite the query string in the original request.
    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
  Uri:
    Type: String
    Description:
      en: The desired URI to which you want to rewrite the path in the original request.
    Required: false
  SiteVersion:
    Type: Number
    Description:
      en: Version number of the site configuration. For a site with configuration version management enabled, you can use this parameter to specify the site version in which the configuration takes effect. The default version is 0.
    Required: false
  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::RewriteUrlRule
    Properties:
      SiteId:
        Ref: SiteId
      RewriteUriType:
        Ref: RewriteUriType
      RuleEnable:
        Ref: RuleEnable
      RewriteQueryStringType:
        Ref: RewriteQueryStringType
      QueryString:
        Ref: QueryString
      Rule:
        Ref: Rule
      Uri:
        Ref: Uri
      SiteVersion:
        Ref: SiteVersion
      RuleName:
        Ref: RuleName
Outputs:
  RewriteUriType:
    Description: URI rewrite type.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RewriteUriType
  RuleEnable:
    Description: Rule switch. When adding global configuration, this parameter does not need to be set.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RuleEnable
  RewriteQueryStringType:
    Description: Query string rewrite type.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RewriteQueryStringType
  QueryString:
    Description: The desired query string to which you want to rewrite the query string in the original request.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - QueryString
  Sequence:
    Description: Rule execution order. The smaller the value, the higher the priority of 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: The configuration ID.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ConfigId
  Uri:
    Description: The desired URI to which you want to rewrite the path in the original request.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Uri
  ConfigType:
    Description: 'Configuration type. This parameter determines whether to query global configurations or feature-specific configurations. Note: This logic only takes effect if the functionName parameter is also provided.'
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ConfigType
  SiteVersion:
    Description: Version number of the site configuration. For a site with configuration version management enabled, you can use this parameter to specify the site version in which the configuration takes effect. The default version is 0.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SiteVersion
  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 website ID, which can be obtained by calling the [ListSites](https://www.alibabacloud.com/help/en/doc-detail/2850189.html) operation."
      },
      "Required": true
    },
    "RewriteUriType": {
      "Type": "String",
      "Description": {
        "en": "URI rewrite type. Value range:\n- `static`: Static mode.\n- `dynamic`: Dynamic mode."
      },
      "AllowedValues": [
        "static",
        "dynamic"
      ],
      "Required": false
    },
    "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
    },
    "RewriteQueryStringType": {
      "Type": "String",
      "Description": {
        "en": "Query string rewrite type. Value range:\n- `static`: Static mode.\n- `dynamic`: Dynamic mode."
      },
      "AllowedValues": [
        "static",
        "dynamic"
      ],
      "Required": false
    },
    "QueryString": {
      "Type": "String",
      "Description": {
        "en": "The desired query string to which you want to rewrite the query string in the original request."
      },
      "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
    },
    "Uri": {
      "Type": "String",
      "Description": {
        "en": "The desired URI to which you want to rewrite the path in the original request."
      },
      "Required": false
    },
    "SiteVersion": {
      "Type": "Number",
      "Description": {
        "en": "Version number of the site configuration. For a site with configuration version management enabled, you can use this parameter to specify the site version in which the configuration takes effect. The default version is 0."
      },
      "Required": false
    },
    "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::RewriteUrlRule",
      "Properties": {
        "SiteId": {
          "Ref": "SiteId"
        },
        "RewriteUriType": {
          "Ref": "RewriteUriType"
        },
        "RuleEnable": {
          "Ref": "RuleEnable"
        },
        "RewriteQueryStringType": {
          "Ref": "RewriteQueryStringType"
        },
        "QueryString": {
          "Ref": "QueryString"
        },
        "Rule": {
          "Ref": "Rule"
        },
        "Uri": {
          "Ref": "Uri"
        },
        "SiteVersion": {
          "Ref": "SiteVersion"
        },
        "RuleName": {
          "Ref": "RuleName"
        }
      }
    }
  },
  "Outputs": {
    "RewriteUriType": {
      "Description": "URI rewrite type.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RewriteUriType"
        ]
      }
    },
    "RuleEnable": {
      "Description": "Rule switch. When adding global configuration, this parameter does not need to be set.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RuleEnable"
        ]
      }
    },
    "RewriteQueryStringType": {
      "Description": "Query string rewrite type.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RewriteQueryStringType"
        ]
      }
    },
    "QueryString": {
      "Description": "The desired query string to which you want to rewrite the query string in the original request.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "QueryString"
        ]
      }
    },
    "Sequence": {
      "Description": "Rule execution order. The smaller the value, the higher the priority of 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": "The configuration ID.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ConfigId"
        ]
      }
    },
    "Uri": {
      "Description": "The desired URI to which you want to rewrite the path in the original request.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Uri"
        ]
      }
    },
    "ConfigType": {
      "Description": "Configuration type. This parameter determines whether to query global configurations or feature-specific configurations. Note: This logic only takes effect if the functionName parameter is also provided.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ConfigType"
        ]
      }
    },
    "SiteVersion": {
      "Description": "Version number of the site configuration. For a site with configuration version management enabled, you can use this parameter to specify the site version in which the configuration takes effect. The default version is 0.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SiteVersion"
        ]
      }
    },
    "RuleName": {
      "Description": "Rule name. When adding global configuration, this parameter does not need to be set.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RuleName"
        ]
      }
    }
  }
}