All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::OSS::Website

更新時間:Oct 14, 2024

ALIYUN::OSS::Website is used to configure static website hosting and redirection rules for an Object Storage Service (OSS) bucket.

Syntax

{
  "Type": "ALIYUN::OSS::Website",
  "Properties": {
    "BucketName": String,
    "WebsiteConfiguration": Map
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

BucketName

String

Yes

No

The bucket name.

None.

WebsiteConfiguration

Map

No

No

The website configurations.

For more information, see WebsiteConfiguration properties.

WebsiteConfiguration syntax

"WebsiteConfiguration": {
  "IndexDocument": Map,
  "RoutingRules": List,
  "ErrorDocument": Map
}

WebsiteConfiguration properties

Property

Type

Required

Editable

Description

Constraint

ErrorDocument

Map

No

No

The properties of the default error page.

For more information, see ErrorDocument properties.

IndexDocument

Map

No

No

The properties of the default homepage.

For more information, see IndexDocument properties.

RoutingRules

List

No

No

The redirection rules. You can specify up to 20 redirection rules.

For more information, see RoutingRules properties.

IndexDocument syntax

"IndexDocument": {
  "Type": String,
  "Suffix": String,
  "SupportSubDir": String
}

IndexDocument properties

Property

Type

Required

Editable

Description

Constraint

Suffix

String

Yes

No

The default homepage.

After the default homepage is specified, OSS returns the default homepage if you access an object whose name ends with a forward slash (/).

SupportSubDir

String

No

No

Specifies whether to redirect the access to the default homepage in the subdirectory when the subdirectory is accessed.

Valid values:

  • true: redirects the access to the default homepage in the subdirectory when the subdirectory is accessed.

  • false (default): redirects the access to the default homepage in the root directory rather than the default homepage in the subdirectory when the subdirectory is accessed.

    For example, the default homepage is index.html, and the path that you want to access is bucket.oss-cn-hangzhou.aliyuncs.com/subdir/. If SupportSubDir is set to false, you are redirected to bucket.oss-cn-hangzhou.aliyuncs.com/index.html. If SupportSubDir is set to true, you are redirected to bucket.oss-cn-hangzhou.aliyuncs.com/subdir/index.html.

Type

String

No

No

The type of operations for the system to perform when the default homepage is specified, the name of the accessed object does not end with a forward slash (/), and the object does not exist.

This property takes effect only when SupportSubDir is set to true and applies after RoutingRule and before ErrorFile. For example, the default homepage is index.html, the path of the abc object that you want to access is bucket.oss-cn-hangzhou.aliyuncs.com/abc, and the abc object does not exist. Valid values:

  • 0 (default): checks whether abc/index.html, which is in the Object name + Forward slash (/) + Homepage format, exists. If abc/index.html exists, the system returns the 302 redirection code and the Location header value is /abc/, which is in the Forward slash (/) + Object name + Forward slash (/) format. If abc/index.html does not exist, the system returns the 404 status code and checks ErrorFile.

  • 1: returns the 404 status code and the NoSuchKey error type, and checks ErrorFile.

  • 2: checks whether abc/index.html exists. If abc/index.html exists, the system returns the content of the object. If abc/index.html does not exist, the system returns the 404 status code and checks ErrorFile.

RoutingRules syntax

"RoutingRules": [
  {
    "Condition": Map,
    "RuleNumber": Integer,
    "Redirect": Map
  }
]

RoutingRules properties

Property

Type

Required

Editable

Description

Constraint

Condition

Map

Yes

No

The matching conditions.

The rule is executed only when all specified conditions are met. A rule is matched only when the rule meets all the conditions that are specified by nodes in the Condition container. For more information, see Condition properties.

RuleNumber

Integer

Yes

No

The sequence number of the redirection rule. OSS matches and executes the redirection rule based on the specified sequence number.

If the rule is matched, OSS executes the rule and do not execute subsequent rules.

Redirect

Map

Yes

No

The operations for the system to perform when the rule is matched.

For more information, see Redirect properties.

Condition syntax

"Condition": {
  "IncludeHeaders": List,
  "KeyPrefixEquals": String,
  "HttpErrorCodeReturnedEquals": String,
  "KeySuffixEquals": String
}

Condition properties

Property

Type

Required

Editable

Description

Constraint

HttpErrorCodeReturnedEquals

String

No

No

The HTTP status code. The rule is matched only when the specified object is accessed and the specified HTTP status code is returned. When RedirectType is set to Mirror, you must set HttpErrorCodeReturnedEquals to 404.

None.

IncludeHeaders

List

No

No

The headers that you want to include in the request. The rule is matched only when the request contains the specified headers and header values.

You can specify up to 10 headers for this property.

KeyPrefixEquals

String

No

No

The prefix of the object name that you want to match.

None.

KeySuffixEquals

String

No

No

The suffix of the object name that you want to match.

None.

IncludeHeaders syntax

"IncludeHeaders": [
  {
    "Equals": String,
    "Key": String
  }
]

IncludeHeaders properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The header name.

None.

Equals

String

No

No

The header value.

None.

Redirect syntax

"Redirect": {
  "MirrorURL": String,
  "ReplaceKeyWith": String,
  "MirrorHeaders": Map,
  "HttpRedirectCode": String,
  "EnableReplacePrefix": Boolean,
  "PassQueryString": Boolean,
  "MirrorFollowRedirect": Boolean,
  "ReplaceKeyPrefixWith": String,
  "RedirectType": String,
  "MirrorPassQueryString": Boolean,
  "MirrorCheckMd5": Boolean,
  "Protocol": String,
  "HostName": String
}

Redirect properties

Property

Type

Required

Editable

Description

Constraint

RedirectType

String

Yes

No

The redirection type.

Valid values:

  • Mirror: mirroring-based back-to-origin redirection. OSS redirects the request to the origin server.

  • External: external redirection. OSS returns an HTTP 3xx status code that redirects the browser or another client to access another address.

  • AliCDN: redirection based on Alibaba Cloud CDN (CDN). Compared with external redirection, OSS adds an additional header to the request. After CDN identifies the header, CDN redirects the access to the specified address and returns the obtained data instead of the HTTP 3xx status code to the user. This eliminates one client redirection operation and improves access speed and efficiency.

EnableReplacePrefix

Boolean

No

No

Specifies whether to replace the prefix of the object name with the value of ReplaceKeyPrefixWith. If you set this property true, the prefix of the object name is replaced with the value of ReplaceKeyPrefixWith. If you leave this property empty or set this property to null, the prefix of the object name is truncated.

Note

You can set this property to true only when ReplaceKeyWith is set to null.

Default value: false.

HttpRedirectCode

String

No

No

The HTTP redirection code in the response.

This property takes effect only when RedirectType is set to External or AliCDN. Default value: 302.

Valid values:

  • 301

  • 302

  • 307

HostName

String

No

No

The domain name for redirection.

The domain name must comply with the domain name conventions.

For example, if the name of the object that you want to access is test, Protocol is set to https, and HostName is set to example.com, the Location header value is https://example.com/test.

MirrorURL

String

No

No

The origin URL for mirroring-based back-to-origin. This property takes effect only when RedirectType is set to Mirror.

The origin URL must start with http:// or https:// and end with a forward slash (/). OSS appends an object name to the end of the URL to generate a back-to-origin URL.

For example, the name of the object that you want to access is myobject. If MirrorURL is set to http://example.com/, the back-to-origin URL is http://example.com/myobject. If MirrorURL is set to http://example.com/dir1/, the back-to-origin URL is http://example.com/dir1/myobject. This way, OSS appends the specified object name to the end of the specified origin URL for mirroring-based back-to-origin to generate a back-to-origin URL.

MirrorHeaders

Map

No

No

The headers that are returned to the origin when you use mirroring-based back-to-origin.

This property takes effect only when RedirectType is set to Mirror. For more information, see the "MirrorHeaders properties" section of this topic.

MirrorFollowRedirect

Boolean

No

No

Specifies whether to redirect the access to the address specified by Location to query data if the origin returns a 3xx status code.

This property takes effect only when RedirectType is set to Mirror. For example, when a mirroring-based back-to-origin request is sent to the origin and Location is specified, the origin returns the 302 status code. Valid values:

  • true: OSS redirects the access to the address specified by Location

    for up to 10 times. If the upper limit is exceeded, the mirroring-based back-to-origin request fails.

  • false: OSS returns the 302 status code and passes through the address specified by Location to the client. The client determines whether to redirect the access.

    Default value: true.

MirrorPassQueryString

Boolean

No

No

This property has the same effect as PassQueryString and takes precedence over PassQueryString.

This property takes effect only when RedirectType is set to Mirror.

Default value: false.

MirrorCheckMd5

Boolean

No

No

Specifies whether to check the MD5 hash of the body of the response returned by the origin.

This property takes effect only when RedirectType is set to Mirror.

When MirrorCheckMd5 is set to true and the response returned by the origin includes the Content-Md5 header, OSS checks whether the MD5 hash of the obtained data matches the header value. If the MD5 hash of the obtained data does not match the header value, OSS does not store the data.

Default value: false.

PassQueryString

Boolean

No

No

Specifies whether to include parameters of the original request in the redirection request when the system performs redirection or mirroring-based back-to-origin.

For example, PassQueryString is set to true, and the a=b&c=d parameter settings are included in a request sent to OSS. If the redirection code specified in the rule is 302, the parameter settings are added to the Location header value for redirection. In this example, the Location header value is changed to example.com?a=b&c=d. If the redirection type is mirroring-based back-to-origin, the parameter settings are also included when you initiate a back-to-origin request.

Default value: false. Valid values: true and false.

Protocol

String

No

No

The protocol.

When the system performs a redirection operation and RedirectType is set to External or AliCDN, the protocol complies with the following rules:

For example, the name of the object that you want to access is test and HostName is set to example.com. If Protocol is set to https, the Location header value is https://example.com/test.

Valid values of Protocol: http and https. In the preceding example, the redirection operation is performed based on HTTPS that is safer than HTTP. If Protocol is set to http, the Location header value is changed to http://example.com/test. You must note that data transmission security is reduced because HTTP does not encrypt communication content.

ReplaceKeyWith

String

No

No

The value that is used to replace the requested object name when the request is redirected.

You can specify a variable for ReplaceKeyWith. The ${key} variable is supported.

For example, the name of the object that you want to access is test. If ReplaceKeyWith is set to prefix/{key}, the object name prefix specified by prefix/ is also included in the object address in the actual access scenario. In this example, the object address specified by the Location header is http://example.com/prefix/test.suffix. suffix specifies the object name suffix. prefix/{key} is used to include the object name prefix in the object address in the actual access scenario.

ReplaceKeyPrefixWith

String

No

No

The value that is used to replace the prefix of the object name during redirection.

For example, if KeyPrefixEquals is set to ABC/ and ReplaceKeyPrefixWith is set to def/ when you access an object named ABC/test.txt, OSS replaces ABC with def.

The original object path is ABC/test.txt. After the redirection rule is applied, the object path is changed to def/test.txt. In this example, you are redirected to http://example.com/def/test.txt when you access http://example.com/ABC/test.txt.

This example is illustrated based on the information you provide and the typical mechanism of URL redirection rules in OSS. To obtain more information about the actual result, you may need to refer to the documentation of the relevant system or service that implements the redirection rule.

MirrorHeaders syntax

"MirrorHeaders": {
  "PassAll": Boolean,
  "Pass": List,
  "Sets": List,
  "Remove": List
}

MirrorHeaders properties

Property

Type

Required

Editable

Description

Constraint

PassAll

Boolean

No

No

Specifies whether to pass through request headers except for the excluded headers to the origin.

This property takes effect only when RedirectType is set to Mirror. The following headers are excluded:

  • Headers such as content-length, authorization, authorization2, range, and date

  • Headers that start with oss-, x-oss-, or x-drs-

Default value: false.

Pass

List

No

No

The headers that you want to pass through to the origin.

This property takes effect only when RedirectType is set to Mirror.

Each header can be up to 1,024 bytes in length, and can contain only digits, letters, and en dashes (‒).

You can specify up to 10 headers for this property.

Remove

List

No

No

The headers that you do not want to pass through to the origin.

This property takes effect only when RedirectType is set to Mirror.

Each header can be up to 1,024 bytes in length, and can contain digits, letters, and en dashes (‒).

You can specify up to 10 headers for this property.

Sets

List

No

No

The headers that are sent to the origin. The headers are configured in the data returned by the origin regardless of whether the headers are included in the request.

This property takes effect only when RedirectType is set to Mirror.

You can specify up to 10 headers for this property. For more information, see the "Sets properties" section of this topic.

Sets syntax

"Sets": [
  {
    "Value": String,
    "Key": String
  }
]

Sets properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The header key. The header key can be up to 1024 bytes in length. The character set of this property is the same as the character set of Pass.

This property takes effect only when RedirectType is set to Mirror.

Value

String

Yes

No

The header value. The header value can be up to 1,024 bytes in length, and cannot contain \r\n.

This property takes effect only when RedirectType is set to Mirror.

ErrorDocument syntax

"ErrorDocument": {
  "HttpStatus": String,
  "Key": String
}

ErrorDocument properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The default error page.

After an error page is specified, the error page is returned if the object that you access does not exist.

HttpStatus

String

No

No

The HTTP status code returned with the error page.

Valid values:

  • 200

  • 404 (default)

Return values

Fn::GetAtt

None.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      BucketName:
        Type: String
        Description:
          en: Bucket name.
        Required: true
      WebsiteConfiguration:
        AssociationPropertyMetadata:
          Parameters:
            IndexDocument:
              AssociationPropertyMetadata:
                Parameters:
                  Type:
                    Type: String
                    Description:
                      en: |-
                        Behavior when an Object that ends with a non-forward slash (/) and does not exist is accessed after setting the default home page. It only takes effect when SupportSubDir is set to true, and it takes effect after RoutingRule and before ErrorFile.
                        Assume that the default home page for the index. The HTML, to access the file path for bucket.oss-cn-hangzhou.aliyuncs.com/abc, and ABC this Object does not exist, at this moment, in different values corresponding to the Type of behavior is as follows:
                        - 0 (default) : Check if abc/index.html exists (Object + forward slash (/) + home page) and return 302 with the URL code of /abc/ as Location header (forward slash (/) + Object + forward slash (/)). If it doesn't, it will return 404 and keep checking ErrorFile.
                        - 1: Directly return 404, error NoSuchKey, continue to check ErrorFile.
                        - 2: Check if abc/index.html exists and return the contents of the Object if it does. If it doesn't, it will return 404 and keep checking ErrorFile.
                    AllowedValues:
                      - '0'
                      - '1'
                      - '2'
                    Required: false
                  Suffix:
                    Type: String
                    Description:
                      en: |-
                        Default home page.
                        After setting the default home page, if you visit an Object ending with a forward slash (/), OSS will return to this default home page.
                    Required: true
                  SupportSubDir:
                    Type: String
                    Description:
                      en: |-
                        Whether to jump to the default home page of a subdirectory when accessing it. The range is as follows:
                        - true: Go to the default home page in a subdirectory.
                        - false (default) : Instead of going to the default home page in a subdirectory, go to the default home page in the root directory.
                        Assume that the default home page for the index. The HTML, to access bucket.oss-cn-hangzhou.aliyuncs.com/subdir/, if set SupportSubDir to false, Then go to bucket.oss-cn-hangzhou.aliyuncs.com/index.html; If set SupportSubDir is true, then transferred to the bucket.oss-cn-hangzhou.aliyuncs.com/subdir/index.html.
                    AllowedValues:
                      - 'true'
                      - 'false'
                    Required: false
              Type: Json
              Description:
                en: The properties of default home page.
              Required: false
            RoutingRules:
              AssociationPropertyMetadata:
                Parameter:
                  AssociationPropertyMetadata:
                    Parameters:
                      Condition:
                        AssociationPropertyMetadata:
                          Parameters:
                            IncludeHeaders:
                              AssociationPropertyMetadata:
                                Parameters:
                                  Equals:
                                    Type: String
                                    Description:
                                      en: The value of the header.
                                    Required: false
                                  Key:
                                    Type: String
                                    Description:
                                      en: The name of the header.
                                    Required: true
                              AssociationProperty: List[Parameters]
                              Type: Json
                              Description:
                                en: This rule will only match if the request contains the specified Header and the value is the specified value. Up to 10.
                              Required: false
                              MaxLength: 10
                            KeyPrefixEquals:
                              Type: String
                              Description:
                                en: The prefix of the Object name to be matched.
                              Required: false
                            HttpErrorCodeReturnedEquals:
                              Type: String
                              Description:
                                en: When accessing the specified Object, this status must be returned to match this rule. This field must be 404 when the jump rule is mirror-back to the source type.
                              Required: false
                            KeySuffixEquals:
                              Type: String
                              Description:
                                en: The suffix of the Object name to be matched.
                              Required: false
                        Type: Json
                        Description:
                          en: |-
                            Conditions for matching.
                            This rule is executed if the specified items are all satisfied. A match is only considered if all conditions for each node under this container are met.
                        Required: true
                      RuleNumber:
                        Type: Number
                        Description:
                          en: Match and execute the sequence number of the RoutingRule, OSS will match the rules in turn according to this sequence number. If the match is successful, this rule is executed and no subsequent rules are executed.
                        Required: true
                        MinValue: 1
                        MaxValue: 20
                      Redirect:
                        AssociationPropertyMetadata:
                          Parameters:
                            MirrorURL:
                              Type: String
                              Description:
                                en: |-
                                  Mirror back to the source station address of the source. This only works if RedirectType is set to Mirror.
                                  The origin URL must begin with http:// or https:// and end with a forward slash (/), which OSS will follow with the Object name to form the return URL.
                                  Name to access the Object myobject, for example, if you specify this to http://example.com/, then back to the source URL for http://example.com/myobject, if you specify this to http://example.com/dir1/, Back to the source URL as http://example.com/dir1/myobject.
                              Required: false
                            ReplaceKeyWith:
                              Type: String
                              Description:
                                en: |-
                                  With Redirect, the Object name is replaced with the value specified by ReplaceKeyWith, which allows you to set variables. The currently supported variable is ${key}, which represents the name of the Object in the request.
                                  Suppose to access the Object for the test, if set ReplaceKeyWith to prefix/${key}. The suffix, is the Location head to http://example.com/prefix/test.suffix.
                              Required: false
                            MirrorHeaders:
                              AssociationPropertyMetadata:
                                Parameters:
                                  PassAll:
                                    Type: Boolean
                                    Description:
                                      en: |-
                                        Whether to pass through other headers to the source except the following headers. This only works if RedirectType is set to Mirror.
                                        - content-length, authorization2, authorization, range, date and other headers
                                        - Headers starting with oss-/x-oss-/x-drs-
                                        Default value: false
                                    Required: false
                                  Pass:
                                    AssociationPropertyMetadata:
                                      Parameter:
                                        Type: String
                                        Description:
                                          en: |-
                                            Specifies the Header that is mirrored back to the source. This only works if RedirectType is set to Mirror.
                                            Each Header is at most 1,024 bytes long and has the character sets 0-9, a-z, A-Z, and dash (-).
                                        AllowedPattern: ^[-a-zA-Z0-9]{1,1024}$
                                        Required: false
                                    AssociationProperty: List[Parameter]
                                    Type: Json
                                    Description:
                                      en: |-
                                        Pass through the specified Header to the source. This only works if RedirectType is set to Mirror.
                                        Each Header is at most 1,024 bytes long and has the character sets 0-9, a-z, A-Z, and dash (-).
                                        A maximum of 10 can be specified for this field.
                                    Required: false
                                    MaxLength: 10
                                  Sets:
                                    AssociationPropertyMetadata:
                                      Parameters:
                                        Value:
                                          Type: String
                                          Description:
                                            en: Set the value of the Header to a maximum of 1024 bytes without \r\n. This only works if RedirectType is set to Mirror.
                                          Required: true
                                          MaxLength: 1024
                                        Key:
                                          Type: String
                                          Description:
                                            en: Sets the Header key to a maximum of 1024 bytes in the same character set as Pass. This only works if RedirectType is set to Mirror.
                                          AllowedPattern: ^[-a-zA-Z0-9]{1,1024}$
                                          Required: true
                                    AssociationProperty: List[Parameters]
                                    Type: Json
                                    Description:
                                      en: |-
                                        Set a Header to the origin, and it will be set when the request is sent back to the origin, regardless of whether the specified headers are included in the request. This only works if RedirectType is set to Mirror.
                                        Up to 10 groups can be specified for this container.
                                    Required: false
                                    MaxLength: 10
                                  Remove:
                                    AssociationPropertyMetadata:
                                      Parameter:
                                        Type: String
                                        Description:
                                          en: |-
                                            Disables pass-through of the specified Header to the source. This only works if RedirectType is set to Mirror.
                                            Each Header is at most 1,024 bytes long and has the character sets 0-9, a-z, A-Z, and dash (-).
                                        AllowedPattern: ^[-a-zA-Z0-9]{1,1024}$
                                        Required: false
                                    AssociationProperty: List[Parameter]
                                    Type: Json
                                    Description:
                                      en: |-
                                        Disables pass-through of the specified Header to the source. This only works if RedirectType is set to Mirror.
                                        Each Header is at most 1,024 bytes long and has the character sets 0-9, a-z, A-Z, and dash (-).
                                        A maximum of 10 can be specified for this field.
                                    Required: false
                                    MaxLength: 10
                              Type: Json
                              Description:
                                en: Specifies the Header that is mirrored back to the source. This only works if RedirectType is set to Mirror.
                              Required: false
                            HttpRedirectCode:
                              Type: String
                              Description:
                                en: |-
                                  Status code returned when jumping. Only if RedirectType is set to External or AliCDN.The default value is 302.
                                  Value: 301, 302, 307
                              AllowedValues:
                                - '301'
                                - '302'
                                - '307'
                              Required: false
                            EnableReplacePrefix:
                              Type: Boolean
                              Description:
                                en: |-
                                  If you set this field to true, the prefix of Object is replaced with the value specified by ReplaceKeyPrefixWith. If this field is not specified or is empty, it means that the Object prefix is truncated.
                                  Notes: This field cannot be set to true when the ReplaceKeyWith field is not null.
                                  Default value: false
                              Required: false
                            PassQueryString:
                              Type: Boolean
                              Description:
                                en: |-
                                  Whether to carry request parameters when performing a jump or mirroring back to the source rule.
                                  Does the user request OSS with the request parameters?  a=b&c=d, and set PassQueryString to true, if the rule is a 302 jump, then this request parameter is added in the Location header of the jump. For example, Location:example.com?a=b&c=d, the jump type is mirror back to the source, then this request parameter will also be carried in the initiated back to the source request.
                                  Valid values: true, false (default)
                              Required: false
                            MirrorFollowRedirect:
                              Type: Boolean
                              Description:
                                en: |-
                                  If the result obtained by mirriling back to the source is 3xx, whether to continue to jump to the specified Location to obtain data. This only works if RedirectType is set to Mirror.
                                  For example, when we mirror back to the source, the source returns a 302 with Location specified.
                                  - If set to true, OSS will continue to request the Location.
                                  It can jump up to 10 times, and if it jumps more than 10 times, it fails to return the mirror back to the source.
                                  - If set to false, OSS will return 302 and pass through the Location.
                                  Default value: true
                              Required: false
                            ReplaceKeyPrefixWith:
                              Type: String
                              Description:
                                en: |-
                                  This value will be substituted for the prefix of the Object name in Redirect. If the prefix is empty, the string is inserted before the Object name.
                                  Notes: Only ReplaceKeyWith or ReplaceKeyPrefixWith nodes are allowed.
                                  Hypothesis to access the Object for ABC/test. TXT, if set KeyPrefixEquals for ABC /, ReplaceKeyPrefixWith for def /, then the Location head to http://example.com/def/test.txt.
                              Required: false
                            RedirectType:
                              Type: String
                              Description:
                                en: |-
                                  Specifies the type of jump. The range is as follows:
                                  - Mirror: Mirror back to the source.
                                  - External: External branch, i.e. OSS will return a 3xx request specifying the branch to another address.
                                  - AliCDN: Aliyun CDN jump, mainly used for the CDN of Aliyun. Unlike External, OSS adds an additional Header. After identifying this Header, Aliyun CDN will actively jump to the specified address and return the obtained data to the user instead of returning the 3xx jump request to the user.
                              AllowedValues:
                                - Mirror
                                - External
                                - AliCDN
                              Required: true
                            MirrorPassQueryString:
                              Type: Boolean
                              Description:
                                en: |-
                                  Same as PassQueryString, but takes precedence over PassQueryString. This only works if RedirectType is set to Mirror.
                                  Default value: false
                              Required: false
                            MirrorCheckMd5:
                              Type: Boolean
                              Description:
                                en: |-
                                  Whether to check MD5 back to the source body. This only works if RedirectType is set to Mirror.
                                  When MirrorCheckMd5 is set to true, and the response returned by the source contains the Content-Md5 Header, OSS checks whether the pulled data MD5 matches this header, if not, it is not saved on OSS.
                                  Default value: false
                              Required: false
                            Protocol:
                              Type: String
                              Description:
                                en: |-
                                  Protocol when jumping. Only if RedirectType is set to External or AliCDN.
                                  If the file you want to access is test, set to go to example.com, and set Protocol to https, the Location header is https://example.com/test.
                                  Value: http, https
                              AllowedValues:
                                - http
                                - https
                              Required: false
                            HostName:
                              Type: String
                              Description:
                                en: |-
                                  The domain name of the jump, the domain name should conform to the domain name specification.
                                  If the file you want to access is test, the Protocol is set to https, and the Hostname is set to example.com, the Location header is https://example.com/test.
                              Required: false
                        Type: Json
                        Description:
                          en: Specifies the action to be performed when this rule is matched.
                        Required: true
                  Type: Json
                  Description:
                    en: The properties of routing rule.
                  Required: false
              AssociationProperty: List[Parameter]
              Type: Json
              Description:
                en: The list of routing rules, up to 20.
              Required: false
              MaxLength: 20
            ErrorDocument:
              AssociationPropertyMetadata:
                Parameters:
                  HttpStatus:
                    Type: String
                    Description:
                      en: 'The HTTP status code of the error page. Valid values: 200, 404 (default).'
                    AllowedValues:
                      - '200'
                      - '404'
                    Required: false
                  Key:
                    Type: String
                    Description:
                      en: |-
                        The default error page.
                        When an error page is specified, if the accessed Object does not exist, this error page is returned.
                    Required: true
              Type: Json
              Description:
                en: The properties of default error page.
              Required: false
        Type: Json
        Description:
          en: Website configuration.
        Required: false
    Resources:
      Website:
        Type: ALIYUN::OSS::Website
        Properties:
          BucketName:
            Ref: BucketName
          WebsiteConfiguration:
            Ref: WebsiteConfiguration
    
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "BucketName": {
          "Type": "String",
          "Description": {
            "en": "Bucket name."
          },
          "Required": true
        },
        "WebsiteConfiguration": {
          "AssociationPropertyMetadata": {
            "Parameters": {
              "IndexDocument": {
                "AssociationPropertyMetadata": {
                  "Parameters": {
                    "Type": {
                      "Type": "String",
                      "Description": {
                        "en": "Behavior when an Object that ends with a non-forward slash (/) and does not exist is accessed after setting the default home page. It only takes effect when SupportSubDir is set to true, and it takes effect after RoutingRule and before ErrorFile.\nAssume that the default home page for the index. The HTML, to access the file path for bucket.oss-cn-hangzhou.aliyuncs.com/abc, and ABC this Object does not exist, at this moment, in different values corresponding to the Type of behavior is as follows:\n- 0 (default) : Check if abc/index.html exists (Object + forward slash (/) + home page) and return 302 with the URL code of /abc/ as Location header (forward slash (/) + Object + forward slash (/)). If it doesn't, it will return 404 and keep checking ErrorFile.\n- 1: Directly return 404, error NoSuchKey, continue to check ErrorFile.\n- 2: Check if abc/index.html exists and return the contents of the Object if it does. If it doesn't, it will return 404 and keep checking ErrorFile."
                      },
                      "AllowedValues": [
                        "0",
                        "1",
                        "2"
                      ],
                      "Required": false
                    },
                    "Suffix": {
                      "Type": "String",
                      "Description": {
                        "en": "Default home page.\nAfter setting the default home page, if you visit an Object ending with a forward slash (/), OSS will return to this default home page."
                      },
                      "Required": true
                    },
                    "SupportSubDir": {
                      "Type": "String",
                      "Description": {
                        "en": "Whether to jump to the default home page of a subdirectory when accessing it. The range is as follows:\n- true: Go to the default home page in a subdirectory.\n- false (default) : Instead of going to the default home page in a subdirectory, go to the default home page in the root directory.\nAssume that the default home page for the index. The HTML, to access bucket.oss-cn-hangzhou.aliyuncs.com/subdir/, if set SupportSubDir to false, Then go to bucket.oss-cn-hangzhou.aliyuncs.com/index.html; If set SupportSubDir is true, then transferred to the bucket.oss-cn-hangzhou.aliyuncs.com/subdir/index.html."
                      },
                      "AllowedValues": [
                        "true",
                        "false"
                      ],
                      "Required": false
                    }
                  }
                },
                "Type": "Json",
                "Description": {
                  "en": "The properties of default home page."
                },
                "Required": false
              },
              "RoutingRules": {
                "AssociationPropertyMetadata": {
                  "Parameter": {
                    "AssociationPropertyMetadata": {
                      "Parameters": {
                        "Condition": {
                          "AssociationPropertyMetadata": {
                            "Parameters": {
                              "IncludeHeaders": {
                                "AssociationPropertyMetadata": {
                                  "Parameters": {
                                    "Equals": {
                                      "Type": "String",
                                      "Description": {
                                        "en": "The value of the header."
                                      },
                                      "Required": false
                                    },
                                    "Key": {
                                      "Type": "String",
                                      "Description": {
                                        "en": "The name of the header."
                                      },
                                      "Required": true
                                    }
                                  }
                                },
                                "AssociationProperty": "List[Parameters]",
                                "Type": "Json",
                                "Description": {
                                  "en": "This rule will only match if the request contains the specified Header and the value is the specified value. Up to 10."
                                },
                                "Required": false,
                                "MaxLength": 10
                              },
                              "KeyPrefixEquals": {
                                "Type": "String",
                                "Description": {
                                  "en": "The prefix of the Object name to be matched."
                                },
                                "Required": false
                              },
                              "HttpErrorCodeReturnedEquals": {
                                "Type": "String",
                                "Description": {
                                  "en": "When accessing the specified Object, this status must be returned to match this rule. This field must be 404 when the jump rule is mirror-back to the source type."
                                },
                                "Required": false
                              },
                              "KeySuffixEquals": {
                                "Type": "String",
                                "Description": {
                                  "en": "The suffix of the Object name to be matched."
                                },
                                "Required": false
                              }
                            }
                          },
                          "Type": "Json",
                          "Description": {
                            "en": "Conditions for matching.\nThis rule is executed if the specified items are all satisfied. A match is only considered if all conditions for each node under this container are met."
                          },
                          "Required": true
                        },
                        "RuleNumber": {
                          "Type": "Number",
                          "Description": {
                            "en": "Match and execute the sequence number of the RoutingRule, OSS will match the rules in turn according to this sequence number. If the match is successful, this rule is executed and no subsequent rules are executed."
                          },
                          "Required": true,
                          "MinValue": 1,
                          "MaxValue": 20
                        },
                        "Redirect": {
                          "AssociationPropertyMetadata": {
                            "Parameters": {
                              "MirrorURL": {
                                "Type": "String",
                                "Description": {
                                  "en": "Mirror back to the source station address of the source. This only works if RedirectType is set to Mirror.\nThe origin URL must begin with http:// or https:// and end with a forward slash (/), which OSS will follow with the Object name to form the return URL.\nName to access the Object myobject, for example, if you specify this to http://example.com/, then back to the source URL for http://example.com/myobject, if you specify this to http://example.com/dir1/, Back to the source URL as http://example.com/dir1/myobject."
                                },
                                "Required": false
                              },
                              "ReplaceKeyWith": {
                                "Type": "String",
                                "Description": {
                                  "en": "With Redirect, the Object name is replaced with the value specified by ReplaceKeyWith, which allows you to set variables. The currently supported variable is ${key}, which represents the name of the Object in the request.\nSuppose to access the Object for the test, if set ReplaceKeyWith to prefix/${key}. The suffix, is the Location head to http://example.com/prefix/test.suffix."
                                },
                                "Required": false
                              },
                              "MirrorHeaders": {
                                "AssociationPropertyMetadata": {
                                  "Parameters": {
                                    "PassAll": {
                                      "Type": "Boolean",
                                      "Description": {
                                        "en": "Whether to pass through other headers to the source except the following headers. This only works if RedirectType is set to Mirror.\n- content-length, authorization2, authorization, range, date and other headers\n- Headers starting with oss-/x-oss-/x-drs-\nDefault value: false"
                                      },
                                      "Required": false
                                    },
                                    "Pass": {
                                      "AssociationPropertyMetadata": {
                                        "Parameter": {
                                          "Type": "String",
                                          "Description": {
                                            "en": "Specifies the Header that is mirrored back to the source. This only works if RedirectType is set to Mirror.\nEach Header is at most 1,024 bytes long and has the character sets 0-9, a-z, A-Z, and dash (-)."
                                          },
                                          "AllowedPattern": "^[-a-zA-Z0-9]{1,1024}$",
                                          "Required": false
                                        }
                                      },
                                      "AssociationProperty": "List[Parameter]",
                                      "Type": "Json",
                                      "Description": {
                                        "en": "Pass through the specified Header to the source. This only works if RedirectType is set to Mirror.\nEach Header is at most 1,024 bytes long and has the character sets 0-9, a-z, A-Z, and dash (-).\nA maximum of 10 can be specified for this field."
                                      },
                                      "Required": false,
                                      "MaxLength": 10
                                    },
                                    "Sets": {
                                      "AssociationPropertyMetadata": {
                                        "Parameters": {
                                          "Value": {
                                            "Type": "String",
                                            "Description": {
                                              "en": "Set the value of the Header to a maximum of 1024 bytes without \\r\\n. This only works if RedirectType is set to Mirror."
                                            },
                                            "Required": true,
                                            "MaxLength": 1024
                                          },
                                          "Key": {
                                            "Type": "String",
                                            "Description": {
                                              "en": "Sets the Header key to a maximum of 1024 bytes in the same character set as Pass. This only works if RedirectType is set to Mirror."
                                            },
                                            "AllowedPattern": "^[-a-zA-Z0-9]{1,1024}$",
                                            "Required": true
                                          }
                                        }
                                      },
                                      "AssociationProperty": "List[Parameters]",
                                      "Type": "Json",
                                      "Description": {
                                        "en": "Set a Header to the origin, and it will be set when the request is sent back to the origin, regardless of whether the specified headers are included in the request. This only works if RedirectType is set to Mirror.\nUp to 10 groups can be specified for this container."
                                      },
                                      "Required": false,
                                      "MaxLength": 10
                                    },
                                    "Remove": {
                                      "AssociationPropertyMetadata": {
                                        "Parameter": {
                                          "Type": "String",
                                          "Description": {
                                            "en": "Disables pass-through of the specified Header to the source. This only works if RedirectType is set to Mirror.\nEach Header is at most 1,024 bytes long and has the character sets 0-9, a-z, A-Z, and dash (-)."
                                          },
                                          "AllowedPattern": "^[-a-zA-Z0-9]{1,1024}$",
                                          "Required": false
                                        }
                                      },
                                      "AssociationProperty": "List[Parameter]",
                                      "Type": "Json",
                                      "Description": {
                                        "en": "Disables pass-through of the specified Header to the source. This only works if RedirectType is set to Mirror.\nEach Header is at most 1,024 bytes long and has the character sets 0-9, a-z, A-Z, and dash (-).\nA maximum of 10 can be specified for this field."
                                      },
                                      "Required": false,
                                      "MaxLength": 10
                                    }
                                  }
                                },
                                "Type": "Json",
                                "Description": {
                                  "en": "Specifies the Header that is mirrored back to the source. This only works if RedirectType is set to Mirror."
                                },
                                "Required": false
                              },
                              "HttpRedirectCode": {
                                "Type": "String",
                                "Description": {
                                  "en": "Status code returned when jumping. Only if RedirectType is set to External or AliCDN.The default value is 302.\nValue: 301, 302, 307"
                                },
                                "AllowedValues": [
                                  "301",
                                  "302",
                                  "307"
                                ],
                                "Required": false
                              },
                              "EnableReplacePrefix": {
                                "Type": "Boolean",
                                "Description": {
                                  "en": "If you set this field to true, the prefix of Object is replaced with the value specified by ReplaceKeyPrefixWith. If this field is not specified or is empty, it means that the Object prefix is truncated.\nNotes: This field cannot be set to true when the ReplaceKeyWith field is not null.\nDefault value: false"
                                },
                                "Required": false
                              },
                              "PassQueryString": {
                                "Type": "Boolean",
                                "Description": {
                                  "en": "Whether to carry request parameters when performing a jump or mirroring back to the source rule.\nDoes the user request OSS with the request parameters?  a=b&c=d, and set PassQueryString to true, if the rule is a 302 jump, then this request parameter is added in the Location header of the jump. For example, Location:example.com?a=b&c=d, the jump type is mirror back to the source, then this request parameter will also be carried in the initiated back to the source request.\nValid values: true, false (default)"
                                },
                                "Required": false
                              },
                              "MirrorFollowRedirect": {
                                "Type": "Boolean",
                                "Description": {
                                  "en": "If the result obtained by mirriling back to the source is 3xx, whether to continue to jump to the specified Location to obtain data. This only works if RedirectType is set to Mirror.\nFor example, when we mirror back to the source, the source returns a 302 with Location specified.\n- If set to true, OSS will continue to request the Location.\nIt can jump up to 10 times, and if it jumps more than 10 times, it fails to return the mirror back to the source.\n- If set to false, OSS will return 302 and pass through the Location.\nDefault value: true"
                                },
                                "Required": false
                              },
                              "ReplaceKeyPrefixWith": {
                                "Type": "String",
                                "Description": {
                                  "en": "This value will be substituted for the prefix of the Object name in Redirect. If the prefix is empty, the string is inserted before the Object name.\nNotes: Only ReplaceKeyWith or ReplaceKeyPrefixWith nodes are allowed.\nHypothesis to access the Object for ABC/test. TXT, if set KeyPrefixEquals for ABC /, ReplaceKeyPrefixWith for def /, then the Location head to http://example.com/def/test.txt."
                                },
                                "Required": false
                              },
                              "RedirectType": {
                                "Type": "String",
                                "Description": {
                                  "en": "Specifies the type of jump. The range is as follows:\n- Mirror: Mirror back to the source.\n- External: External branch, i.e. OSS will return a 3xx request specifying the branch to another address.\n- AliCDN: Aliyun CDN jump, mainly used for the CDN of Aliyun. Unlike External, OSS adds an additional Header. After identifying this Header, Aliyun CDN will actively jump to the specified address and return the obtained data to the user instead of returning the 3xx jump request to the user."
                                },
                                "AllowedValues": [
                                  "Mirror",
                                  "External",
                                  "AliCDN"
                                ],
                                "Required": true
                              },
                              "MirrorPassQueryString": {
                                "Type": "Boolean",
                                "Description": {
                                  "en": "Same as PassQueryString, but takes precedence over PassQueryString. This only works if RedirectType is set to Mirror.\nDefault value: false"
                                },
                                "Required": false
                              },
                              "MirrorCheckMd5": {
                                "Type": "Boolean",
                                "Description": {
                                  "en": "Whether to check MD5 back to the source body. This only works if RedirectType is set to Mirror.\nWhen MirrorCheckMd5 is set to true, and the response returned by the source contains the Content-Md5 Header, OSS checks whether the pulled data MD5 matches this header, if not, it is not saved on OSS.\nDefault value: false"
                                },
                                "Required": false
                              },
                              "Protocol": {
                                "Type": "String",
                                "Description": {
                                  "en": "Protocol when jumping. Only if RedirectType is set to External or AliCDN.\nIf the file you want to access is test, set to go to example.com, and set Protocol to https, the Location header is https://example.com/test.\nValue: http, https"
                                },
                                "AllowedValues": [
                                  "http",
                                  "https"
                                ],
                                "Required": false
                              },
                              "HostName": {
                                "Type": "String",
                                "Description": {
                                  "en": "The domain name of the jump, the domain name should conform to the domain name specification.\nIf the file you want to access is test, the Protocol is set to https, and the Hostname is set to example.com, the Location header is https://example.com/test."
                                },
                                "Required": false
                              }
                            }
                          },
                          "Type": "Json",
                          "Description": {
                            "en": "Specifies the action to be performed when this rule is matched."
                          },
                          "Required": true
                        }
                      }
                    },
                    "Type": "Json",
                    "Description": {
                      "en": "The properties of routing rule."
                    },
                    "Required": false
                  }
                },
                "AssociationProperty": "List[Parameter]",
                "Type": "Json",
                "Description": {
                  "en": "The list of routing rules, up to 20."
                },
                "Required": false,
                "MaxLength": 20
              },
              "ErrorDocument": {
                "AssociationPropertyMetadata": {
                  "Parameters": {
                    "HttpStatus": {
                      "Type": "String",
                      "Description": {
                        "en": "The HTTP status code of the error page. Valid values: 200, 404 (default)."
                      },
                      "AllowedValues": [
                        "200",
                        "404"
                      ],
                      "Required": false
                    },
                    "Key": {
                      "Type": "String",
                      "Description": {
                        "en": "The default error page.\nWhen an error page is specified, if the accessed Object does not exist, this error page is returned."
                      },
                      "Required": true
                    }
                  }
                },
                "Type": "Json",
                "Description": {
                  "en": "The properties of default error page."
                },
                "Required": false
              }
            }
          },
          "Type": "Json",
          "Description": {
            "en": "Website configuration."
          },
          "Required": false
        }
      },
      "Resources": {
        "Website": {
          "Type": "ALIYUN::OSS::Website",
          "Properties": {
            "BucketName": {
              "Ref": "BucketName"
            },
            "WebsiteConfiguration": {
              "Ref": "WebsiteConfiguration"
            }
          }
        }
      }
    }