Tous les produits
Search
Centre de documentation

Resource Orchestration Service:ALIYUN::OSS::Website

Dernière mise à jour :Aug 10, 2026

Configure l'hébergement de site web statique et les règles de redirection pour un compartiment Object Storage Service (OSS).

Syntaxe

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

Propriétés

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

BucketName

String

Oui

Non

Nom du compartiment.

Aucune.

WebsiteConfiguration

Map

Non

Non

Configuration du site web.

Propriétés WebsiteConfiguration.

Syntaxe de WebsiteConfiguration

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

Propriétés de WebsiteConfiguration

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

ErrorDocument

Map

Non

Non

Propriétés de la page d'erreur par défaut.

Propriétés ErrorDocument.

IndexDocument

Map

Non

Non

Propriétés de la page d'accueil par défaut.

Propriétés IndexDocument.

RoutingRules

List

Non

Non

Règles de redirection. Maximum : 20.

Propriétés RoutingRules.

Syntaxe d'IndexDocument

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

Propriétés d'IndexDocument

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

Suffix

String

Oui

Non

Page d'accueil par défaut.

Lorsqu'elle est définie, OSS renvoie cette page pour les requêtes concernant des objets se terminant par une barre oblique (/).

SupportSubDir

String

Non

Non

Indique s'il faut rediriger vers la page d'accueil par défaut dans le sous-répertoire.

Valeurs valides :

  • true : redirige vers la page d'accueil par défaut dans le sous-répertoire.

  • false (par défaut) : redirige vers la page d'accueil par défaut dans le répertoire racine.

    Par exemple, si la page d'accueil par défaut est index.html et que le chemin d'accès souhaité est bucket.oss-cn-hangzhou.aliyuncs.com/subdir/, une valeur false pour SupportSubDir entraîne une redirection vers bucket.oss-cn-hangzhou.aliyuncs.com/index.html. Une valeur true entraîne une redirection vers bucket.oss-cn-hangzhou.aliyuncs.com/subdir/index.html.

Type

String

Non

Non

Action à effectuer lorsque la page d'accueil par défaut est définie, que le nom de l'objet accédé ne se termine pas par une barre oblique (/) et que l'objet n'existe pas.

Prend effet uniquement lorsque SupportSubDir a la valeur true. Appliqué après RoutingRule et avant ErrorFile. Par exemple, si la page d'accueil par défaut est index.html et que vous accédez à bucket.oss-cn-hangzhou.aliyuncs.com/abc (où l'objet abc n'existe pas). Valeurs valides :

  • 0 (par défaut) : vérifie si abc/index.html existe. Si c'est le cas, renvoie 302 avec l'en-tête Location /abc/. Sinon, renvoie 404 et vérifie ErrorFile.

  • 1 : renvoie le code d'état 404 et le type d'erreur NoSuchKey, puis vérifie ErrorFile.

  • 2 : vérifie si abc/index.html existe. Si abc/index.html existe, le système renvoie le contenu de l'objet. Si abc/index.html n'existe pas, le système renvoie le code d'état 404 et vérifie ErrorFile.

Syntaxe de RoutingRules

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

Propriétés de RoutingRules

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

Condition

Map

Oui

Non

Conditions de correspondance.

La règle s'exécute uniquement lorsque toutes les conditions spécifiées sont remplies. Propriétés Condition.

RuleNumber

Integer

Oui

Non

Numéro de séquence de la règle de redirection. OSS fait correspondre les règles par ordre croissant.

En cas de correspondance, OSS exécute cette règle et ignore les règles suivantes.

Redirect

Map

Oui

Non

Action à effectuer lorsque la règle correspond.

Propriétés Redirect.

Syntaxe de Condition

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

Propriétés de Condition

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

HttpErrorCodeReturnedEquals

String

Non

Non

Code d'état HTTP qui déclenche la règle. Lorsque RedirectType est Mirror, ce code doit être 404.

Aucune.

IncludeHeaders

List

Non

Non

En-têtes de requête à faire correspondre. La règle se déclenche uniquement lorsque la requête contient ces en-têtes et valeurs.

Vous pouvez spécifier jusqu'à 10 en-têtes pour cette propriété.

KeyPrefixEquals

String

Non

Non

Préfixe du nom d'objet à faire correspondre.

Aucune.

KeySuffixEquals

String

Non

Non

Suffixe du nom d'objet à faire correspondre.

Aucune.

Syntaxe d'IncludeHeaders

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

Propriétés d'IncludeHeaders

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

Key

String

Oui

Non

Nom de l'en-tête.

Aucune.

Equals

String

Non

Non

Valeur de l'en-tête.

Aucune.

Syntaxe de Redirect

"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
}

Propriétés de redirection

Property

Type

Required

Editable

Description

Constraint

RedirectType

String

Yes

No

Le type de redirection.

Valeurs valides :

  • Mirror : redirection de récupération par miroir vers l'origine. OSS redirige la requête vers le serveur d'origine.

  • External : redirection externe. OSS renvoie un code d'état HTTP 3xx qui redirige le navigateur ou un autre client vers une autre adresse.

  • AliCDN : redirection Alibaba Cloud CDN. OSS ajoute un en-tête reconnu par le CDN pour récupérer et renvoyer les données directement, évitant ainsi une redirection côté client.

EnableReplacePrefix

Boolean

No

No

Indique s'il faut remplacer le préfixe du nom de l'objet par la valeur de ReplaceKeyPrefixWith. Si cette valeur est vide ou nulle, le préfixe est tronqué.

Remarque

Vous pouvez définir cette propriété sur true uniquement lorsque ReplaceKeyWith est défini sur null.

Valeur par défaut : false.

HttpRedirectCode

String

No

No

Le code de redirection HTTP dans la réponse.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur External ou AliCDN. Valeur par défaut : 302.

Valeurs valides :

  • 301

  • 302

  • 307

HostName

String

No

No

Le nom de domaine pour la redirection.

Le nom de domaine doit être conforme aux conventions relatives aux noms de domaine.

Par exemple, si le nom de l'objet que vous souhaitez accéder est test, Protocol est défini sur https et HostName est défini sur example.com, la valeur de l'en-tête Location est https://example.com/test.

MirrorURL

String

No

No

L'URL d'origine pour la récupération par miroir vers l'origine. Prend effet uniquement lorsque RedirectType est Mirror.

Doit commencer par http:// ou https:// et se terminer par une barre oblique (/). OSS ajoute le nom de l'objet pour générer l'URL de récupération vers l'origine.

Par exemple, pour accéder à myobject : si MirrorURL est http://example.com/, l'URL de récupération vers l'origine est http://example.com/myobject. Si MirrorURL est http://example.com/dir1/, l'URL est http://example.com/dir1/myobject.

MirrorHeaders

Map

No

No

En-têtes renvoyés à l'origine lors de la récupération par miroir vers l'origine.

Prend effet uniquement lorsque RedirectType est Mirror.

MirrorFollowRedirect

Boolean

No

No

Indique s'il faut suivre l'en-tête Location si l'origine renvoie un code d'état 3xx.

Prend effet uniquement lorsque RedirectType est Mirror. Valeurs valides :

  • true : OSS suit l'en-tête Location

    pour un maximum de 10 redirections. Si ce nombre est dépassé, la requête de récupération vers l'origine échoue.

  • false : OSS renvoie 302 et transmet l'en-tête Location. Le client gère la redirection.

    Valeur par défaut : true.

MirrorPassQueryString

Boolean

No

No

Identique à PassQueryString, mais avec une priorité supérieure.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur Mirror.

Valeur par défaut : false.

MirrorCheckMd5

Boolean

No

No

Indique s'il faut vérifier le hachage MD5 du corps de la réponse provenant de l'origine.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur Mirror.

Lorsque cette option est définie sur true et que la réponse de l'origine inclut l'en-tête Content-Md5, OSS vérifie que le MD5 des données correspond. Dans le cas contraire, OSS ne stocke pas les données.

Valeur par défaut : false.

PassQueryString

Boolean

No

No

Indique s'il faut inclure les paramètres de la requête d'origine dans la requête de redirection ou de récupération vers l'origine.

Par exemple, si PassQueryString est true et que la requête contient a=b&c=d : pour une redirection 302, les paramètres sont ajoutés à l'en-tête Location (par exemple, example.com?a=b&c=d) ; pour une récupération par miroir vers l'origine, les paramètres sont inclus dans la requête de récupération vers l'origine.

Valeur par défaut : false. Valeurs valides : true et false.

Protocol

String

No

No

Le protocole de redirection.

Prend effet lorsque RedirectType est External ou AliCDN.

Par exemple, si l'objet est test et que HostName est example.com : lorsque Protocol est https, l'en-tête Location est https://example.com/test.

Valeurs valides : http, https.

ReplaceKeyWith

String

No

No

La valeur utilisée pour remplacer le nom de l'objet lors de la redirection.

Vous pouvez spécifier une variable pour ReplaceKeyWith. La variable ${key} est prise en charge.

Par exemple, le nom de l'objet auquel vous souhaitez accéder est test. Si ReplaceKeyWith est défini sur prefix/{key}, le préfixe du nom de l'objet spécifié par prefix/ est également inclus dans l'adresse de l'objet dans le scénario d'accès réel. Dans cet exemple, l'adresse de l'objet spécifiée par l'en-tête Location est http://example.com/prefix/test.suffix. suffix spécifie le suffixe du nom de l'objet. prefix/{key} est utilisé pour inclure le préfixe du nom de l'objet dans l'adresse de l'objet dans le scénario d'accès réel.

ReplaceKeyPrefixWith

String

No

No

La valeur utilisée pour remplacer le préfixe du nom de l'objet lors de la redirection.

Par exemple, si KeyPrefixEquals est défini sur ABC/ et ReplaceKeyPrefixWith sur def/ lorsque vous accédez à un objet nommé ABC/test.txt, OSS remplace ABC par def.

Le chemin d'accès original de l'objet est ABC/test.txt. Après l'application de la règle de redirection, le chemin d'accès de l'objet devient def/test.txt. Dans cet exemple, vous êtes redirigé vers http://example.com/def/test.txt lorsque vous accédez à http://example.com/ABC/test.txt.

Reportez-vous à la documentation OSS pour plus de détails sur le comportement de redirection.

Syntaxe de MirrorHeaders

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

Propriétés de MirrorHeaders

Property

Type

Required

Editable

Description

Constraint

PassAll

Boolean

No

No

Indique s'il faut transmettre les en-têtes de requête (à l'exception de ceux exclus) à l'origine.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur Mirror. Les en-têtes suivants sont exclus :

  • En-têtes tels que content-length, authorization, authorization2, range et date

  • En-têtes commençant par oss-, x-oss- ou x-drs-

Valeur par défaut : false.

Pass

List

No

No

Les en-têtes que vous souhaitez transmettre à l'origine.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur Mirror.

Chaque en-tête peut avoir une longueur maximale de 1 024 octets et ne peut contenir que des chiffres, des lettres et des tirets demi-cadratins (‒).

Vous pouvez spécifier jusqu'à 10 en-têtes pour cette propriété.

Remove

List

No

No

Les en-têtes que vous ne souhaitez pas transmettre à l'origine.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur Mirror.

Chaque en-tête peut avoir une longueur maximale de 1 024 octets et peut contenir des chiffres, des lettres et des tirets demi-cadratins (‒).

Vous pouvez spécifier jusqu'à 10 en-têtes pour cette propriété.

Sets

List

No

No

En-têtes envoyés à l'origine, qu'ils soient présents ou non dans la requête d'origine.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur Mirror.

Vous pouvez spécifier jusqu'à 10 en-têtes.

Syntaxe de Sets

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

Propriétés de Sets

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

La clé de l'en-tête. La clé de l'en-tête peut avoir une longueur maximale de 1 024 octets. Le jeu de caractères de cette propriété est identique à celui de Pass.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur Mirror.

Value

String

Yes

No

La valeur de l'en-tête. La valeur de l'en-tête peut avoir une longueur maximale de 1 024 octets et ne peut pas contenir \r\n.

Cette propriété prend effet uniquement lorsque RedirectType est défini sur Mirror.

Syntaxe d'ErrorDocument

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

Propriétés ErrorDocument

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

Key

String

Oui

Non

La page d'erreur par défaut.

Renvoie cette page lorsque l'objet demandé n'existe pas.

HttpStatus

String

Non

Non

Le code de statut HTTP renvoyé avec la page d'erreur.

Valeurs valides :

  • 200

  • 404 (par défaut)

Valeurs de retour

Fn::GetAtt

Aucune.

Exemples

  • 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"
            }
          }
        }
      }
    }