Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::OSS::Website

Última atualização: Jun 27, 2026

Configura a hospedagem de site estático e as regras de redirecionamento para um bucket do Object Storage Service (OSS).

Sintaxe

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

Propriedades

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

BucketName

String

Sim

Não

Nome do bucket.

Nenhuma.

WebsiteConfiguration

Map

Não

Não

Configuração do site.

Propriedades de WebsiteConfiguration.

Sintaxe de WebsiteConfiguration

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

Propriedades de WebsiteConfiguration

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

ErrorDocument

Map

Não

Não

Propriedades da página de erro padrão.

Propriedades de ErrorDocument.

IndexDocument

Map

Não

Não

Propriedades da página inicial padrão.

Propriedades de IndexDocument.

RoutingRules

List

Não

Não

Regras de redirecionamento. Máximo: 20.

Propriedades de RoutingRules.

Sintaxe de IndexDocument

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

Propriedades de IndexDocument

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

Suffix

String

Sim

Não

Página inicial padrão.

Quando definida, o OSS retorna esta página para solicitações de objetos que terminam com barra (/).

SupportSubDir

String

Não

Não

Define se o redirecionamento ocorre para a página inicial padrão no subdiretório.

Valores válidos:

  • true: redireciona para a página inicial padrão no subdiretório.

  • false (padrão): redireciona para a página inicial padrão no diretório raiz.

    Por exemplo, se a página inicial padrão for index.html e o caminho de acesso for bucket.oss-cn-hangzhou.aliyuncs.com/subdir/: com SupportSubDir definido como false, o redirecionamento será para bucket.oss-cn-hangzhou.aliyuncs.com/index.html; com SupportSubDir definido como true, o redirecionamento será para bucket.oss-cn-hangzhou.aliyuncs.com/subdir/index.html.

Type

String

Não

Não

Ação executada quando a página inicial padrão está definida, o nome do objeto acessado não termina com barra (/) e o objeto não existe.

Válida apenas quando SupportSubDir é true. Aplicada após RoutingRule e antes de ErrorFile. Por exemplo, se a página inicial padrão for index.html e você acessar bucket.oss-cn-hangzhou.aliyuncs.com/abc (onde o objeto abc não existe). Valores válidos:

  • 0 (padrão): verifica se abc/index.html existe. Se existir, retorna 302 com o cabeçalho Location /abc/. Caso contrário, retorna 404 e verifica ErrorFile.

  • 1: retorna o código de status 404 e o tipo de erro NoSuchKey, e verifica ErrorFile.

  • 2: verifica se abc/index.html existe. Se existir, o sistema retorna o conteúdo do objeto. Caso contrário, o sistema retorna o código de status 404 e verifica ErrorFile.

Sintaxe de RoutingRules

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

Propriedades de RoutingRules

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

Condition

Map

Sim

Não

Condições de correspondência.

A regra executa apenas quando todas as condições especificadas são atendidas. Propriedades de Condition.

RuleNumber

Integer

Sim

Não

Número de sequência da regra de redirecionamento. O OSS corresponde às regras em ordem crescente.

Se houver correspondência, o OSS executa esta regra e ignora as subsequentes.

Redirect

Map

Sim

Não

Ação a executar quando a regra corresponder.

Propriedades de Redirect.

Sintaxe de Condition

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

Propriedades de Condition

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

HttpErrorCodeReturnedEquals

String

Não

Não

Código de status HTTP que aciona a regra. Quando RedirectType é Mirror, este valor deve ser 404.

Nenhuma.

IncludeHeaders

List

Não

Não

Cabeçalhos de solicitação para correspondência. A regra é acionada apenas quando a solicitação contém esses cabeçalhos e valores.

É possível especificar até 10 cabeçalhos para esta propriedade.

KeyPrefixEquals

String

Não

Não

Prefixo do nome do objeto para correspondência.

Nenhuma.

KeySuffixEquals

String

Não

Não

Sufixo do nome do objeto para correspondência.

Nenhuma.

Sintaxe de IncludeHeaders

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

Propriedades de IncludeHeaders

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

Key

String

Sim

Não

Nome do cabeçalho.

Nenhuma.

Equals

String

Não

Não

Valor do cabeçalho.

Nenhuma.

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

Propriedades de Redirect

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

RedirectType

String

Sim

Não

Tipo de redirecionamento.

Valores válidos:

  • Mirror: redirecionamento back-to-origin baseado em espelhamento. O OSS redireciona a solicitação para o servidor de origem.

  • External: redirecionamento externo. O OSS retorna um código de status HTTP 3xx que redireciona o navegador ou outro cliente para acessar outro endereço.

  • AliCDN: redirecionamento do Alibaba Cloud CDN. O OSS adiciona um cabeçalho reconhecido pelo CDN para buscar e retornar dados diretamente, evitando redirecionamento no lado do cliente.

EnableReplacePrefix

Boolean

Não

Não

Define se o prefixo do nome do objeto deve ser substituído pelo valor de ReplaceKeyPrefixWith. Se estiver vazio ou nulo, o prefixo será truncado.

Nota

Esta propriedade só pode ser definida como true quando ReplaceKeyWith estiver definido como null.

Valor padrão: false.

HttpRedirectCode

String

Não

Não

Código de redirecionamento HTTP na resposta.

Esta propriedade tem efeito apenas quando RedirectType está definido como External ou AliCDN. Valor padrão: 302.

Valores válidos:

  • 301

  • 302

  • 307

HostName

String

Não

Não

Nome de domínio para redirecionamento.

O nome de domínio deve estar em conformidade com as convenções de nomenclatura.

Por exemplo, se o nome do objeto a acessar for test, Protocol estiver definido como https e HostName estiver definido como example.com, o valor do cabeçalho Location será https://example.com/test.

MirrorURL

String

Não

Não

URL de origem para back-to-origin baseado em espelhamento. Tem efeito apenas quando RedirectType é Mirror.

Deve começar com http:// ou https:// e terminar com barra (/). O OSS anexa o nome do objeto para gerar a URL de back-to-origin.

Por exemplo, para acessar myobject: se MirrorURL for http://example.com/, a URL de back-to-origin será http://example.com/myobject. Se MirrorURL for http://example.com/dir1/, a URL será http://example.com/dir1/myobject.

MirrorHeaders

Map

Não

Não

Cabeçalhos retornados à origem durante o back-to-origin baseado em espelhamento.

Tem efeito apenas quando RedirectType é Mirror.

MirrorFollowRedirect

Boolean

Não

Não

Define se o cabeçalho Location deve ser seguido caso a origem retorne um código de status 3xx.

Tem efeito apenas quando RedirectType é Mirror. Valores válidos:

  • true: o OSS segue o cabeçalho Location

    por até 10 redirecionamentos. Se esse limite for excedido, a solicitação de back-to-origin falhará.

  • false: o OSS retorna 302 e repassa o cabeçalho Location. O cliente lida com o redirecionamento.

    Valor padrão: true.

MirrorPassQueryString

Boolean

Não

Não

Igual a PassQueryString, mas tem precedência.

Esta propriedade tem efeito apenas quando RedirectType está definido como Mirror.

Valor padrão: false.

MirrorCheckMd5

Boolean

Não

Não

Define se o hash MD5 do corpo da resposta da origem deve ser verificado.

Esta propriedade tem efeito apenas quando RedirectType está definido como Mirror.

Quando definido como true e a resposta da origem incluir o cabeçalho Content-Md5, o OSS verifica se o MD5 dos dados corresponde. Caso contrário, o OSS não armazena os dados.

Valor padrão: false.

PassQueryString

Boolean

Não

Não

Define se os parâmetros da solicitação original devem ser incluídos no redirecionamento ou na solicitação de back-to-origin.

Por exemplo, se PassQueryString for true e a solicitação contiver a=b&c=d: para um redirecionamento 302, os parâmetros são anexados ao cabeçalho Location (ex.: example.com?a=b&c=d); para back-to-origin baseado em espelhamento, os parâmetros são incluídos na solicitação de back-to-origin.

Valor padrão: false. Valores válidos: true e false.

Protocol

String

Não

Não

Protocolo de redirecionamento.

Tem efeito quando RedirectType é External ou AliCDN.

Por exemplo, se o objeto for test e HostName for example.com: quando Protocol for https, o cabeçalho Location será https://example.com/test.

Valores válidos: http, https.

ReplaceKeyWith

String

Não

Não

Valor usado para substituir o nome do objeto durante o redirecionamento.

É possível especificar uma variável para ReplaceKeyWith. A variável ${key} é suportada.

Por exemplo, suponha que o nome do objeto a ser acessado seja test. Se ReplaceKeyWith estiver definido como prefix/{key}, o prefixo do nome do objeto especificado por prefix/ também será incluído no endereço do objeto no cenário de acesso real. Neste exemplo, o endereço do objeto especificado pelo cabeçalho Location é http://example.com/prefix/test.suffix. suffix especifica o sufixo do nome do objeto. prefix/{key} é usado para incluir o prefixo do nome do objeto no endereço do objeto no cenário de acesso real.

ReplaceKeyPrefixWith

String

Não

Não

Valor usado para substituir o prefixo do nome do objeto durante o redirecionamento.

Por exemplo, se KeyPrefixEquals estiver definido como ABC/ e ReplaceKeyPrefixWith estiver definido como def/ ao acessar um objeto chamado ABC/test.txt, o OSS substitui ABC por def.

O caminho original do objeto é ABC/test.txt. Após a aplicação da regra de redirecionamento, o caminho do objeto muda para def/test.txt. Neste exemplo, o redirecionamento ocorre para http://example.com/def/test.txt ao acessar http://example.com/ABC/test.txt.

Consulte a documentação do OSS para obter detalhes sobre o comportamento de redirecionamento.

Sintaxe de MirrorHeaders

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

Propriedades de MirrorHeaders

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

PassAll

Boolean

Não

Não

Define se os cabeçalhos da solicitação (exceto os excluídos) devem ser repassados para a origem.

Esta propriedade tem efeito apenas quando RedirectType está definido como Mirror. Os seguintes cabeçalhos são excluídos:

  • Cabeçalhos como content-length, authorization, authorization2, range e date

  • Cabeçalhos que começam com oss-, x-oss- ou x-drs-

Valor padrão: false.

Pass

List

Não

Não

Cabeçalhos a serem repassados para a origem.

Esta propriedade tem efeito apenas quando RedirectType está definido como Mirror.

Cada cabeçalho pode ter até 1.024 bytes de comprimento e conter apenas dígitos, letras e traços curtos (‒).

É possível especificar até 10 cabeçalhos para esta propriedade.

Remove

List

Não

Não

Cabeçalhos a serem bloqueados no repasse para a origem.

Esta propriedade tem efeito apenas quando RedirectType está definido como Mirror.

Cada cabeçalho pode ter até 1.024 bytes de comprimento e conter dígitos, letras e traços curtos (‒).

É possível especificar até 10 cabeçalhos para esta propriedade.

Sets

List

Não

Não

Cabeçalhos enviados à origem independentemente de estarem presentes na solicitação original.

Esta propriedade tem efeito apenas quando RedirectType está definido como Mirror.

É possível especificar até 10 cabeçalhos.

Sintaxe de Sets

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

Propriedades de Sets

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

Key

String

Sim

Não

Chave do cabeçalho. Pode ter até 1.024 bytes de comprimento. O conjunto de caracteres desta propriedade é o mesmo da propriedade Pass.

Esta propriedade tem efeito apenas quando RedirectType está definido como Mirror.

Value

String

Sim

Não

Valor do cabeçalho. Pode ter até 1.024 bytes de comprimento e não pode conter \r\n.

Esta propriedade tem efeito apenas quando RedirectType está definido como Mirror.

Sintaxe de ErrorDocument

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

Propriedades de ErrorDocument

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

Key

String

Sim

Não

Página de erro padrão.

Retorna esta página quando o objeto solicitado não existe.

HttpStatus

String

Não

Não

Código de status HTTP retornado com a página de erro.

Valores válidos:

  • 200

  • 404 (padrão)

Valores de retorno

Fn::GetAtt

Nenhum.

Exemplos

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