Element | Type | Required | Description |
Redirect | Container | Conditional This element must be specified if RoutingRule is specified. | The operation to perform after the rule is matched. Parent nodes: RoutingRule |
RedirectType | String | Conditional This parameter must be specified if Redirect is specified. | The redirection type. Valid values: Mirror: mirroring-based back-to-origin. External: external redirection. OSS returns the 3xx HTTP redirect code and the Location header for you to redirect the access to another IP address. AliCDN: redirection based on Alibaba Cloud Content Delivery Network (CDN). OSS adds an additional header to the request, which is different from the External type. After CDN identifies the header, CDN redirects the access to the specified IP address and returns the obtained data instead of the redirect request to the user.
Parent nodes: Redirect |
PassQueryString | Boolean | No | Specifies whether to include parameters of the original request in the redirect request when the system runs the redirection rule or mirroring-based back-to-origin rule. For example, if the PassQueryString parameter is set to true and the ?a=b&c=d parameter is included in a request sent to OSS, PassQueryString is set to true, and the redirection mode is 302, this parameter is added to the Location header. For example, if the request is Location:example.com?a=b&c=d and the redirection type is mirroring-based back-to-origin, the ?a=b&c=d parameter is also included in the back-to-origin request. Default value: false Valid values: true and false Parent nodes: Redirect |
MirrorURL | String | Conditional This element must be specified if RedirectType is set to Mirror. | The origin URL for mirroring-based back-to-origin. This element takes effect only when the value of RedirectType is Mirror. The origin URL must start with http:// or https:// and end with a forward slash (/). OSS adds an object name to the end of the URL to generate a back-to-origin URL. For example, the name of the object to access is myobject. If MirrorURL is set to http://example.com/ , the back-to-origin URL is http://example.com/myobject . If MirrorURL is set to http://example.com/dir1/ , the back-to-origin URL is http://example.com/dir1/myobject . Parent nodes: Redirect |
MirrorPassQueryString | Boolean | No | This element plays the same role as PassQueryString and has a higher priority than PassQueryString. This element takes effect only when the value of RedirectType is Mirror. Default value: false Parent nodes: Redirect |
MirrorFollowRedirect | Boolean | No | Specifies whether to redirect the access to the address specified by Location if the origin returns a 3xx HTTP status code. This element takes effect only when the value of RedirectType is Mirror. For example, when a mirroring-based back-to-origin request is initiated, the origin returns 302 and Location is specified. If you set MirrorFollowRedirect to true, OSS continues to request the address specified by Location. The access can be redirected for up to 10 times. If the access is redirected for more than 10 times, the mirroring-based back-to-origin request fails. If you set MirrorFollowRedirect to false, OSS returns 302 and passes through Location.
Default value: true Parent nodes: Redirect |
MirrorCheckMd5 | Boolean | No | Specifies whether to check the MD5 hash of the body of the response returned by the origin. This element takes effect only when the value of RedirectType is Mirror. When the MirrorFollowRedirect value is true and the response returned by the origin includes the Content-Md5 header, OSS checks whether the MD5 hash of the obtained data matches the header value. If the MD5 hash of the obtained data does not match the header value, OSS does not store the data. Default value: false Parent nodes: Redirect |
MirrorHeaders | Container | No | The headers contained in the response that is returned when you use mirroring-based back-to-origin. This element takes effect only when the value of RedirectType is Mirror. Parent nodes: Redirect |
PassAll | Boolean | No | Specifies whether to pass through all request headers to the origin. This element takes effect only when the value of RedirectType is Mirror. The request headers exclude the following headers: Headers such as content-length, authorization2, authorization, range, and date Headers that start with oss-, x-oss-, and x-drs-
Default value: false Parent nodes: MirrorHeaders |
Pass | String | No | The headers to pass through to the origin. This element takes effect only when the value of RedirectType is Mirror. Each header can be up to 1,024 bytes in length and can contain only letters, digits, and hyphens (-). You can specify up to 10 Pass headers. Parent nodes: MirrorHeaders |
Remove | String | No | The headers that are not allowed to pass through to the origin. This element takes effect only when the value of RedirectType is Mirror. Each header can be up to 1,024 bytes in length. The character set of this parameter is the same as that of Pass. You can specify up to 10 Remove headers. This parameter is used together with PassAll. Parent nodes: MirrorHeaders |
Set | Container | No | The header that is sent to the origin. The header is configured in the data returned by the origin regardless of whether the header is included in the request. This element takes effect only when the value of RedirectType is Mirror. You can specify up to 10 Set headers. Parent nodes: MirrorHeaders |
Key | String | Conditional This element must be specified if Set is specified. | The key of the header. The key can be up to 1,024 bytes in length. The character set of this parameter is the same as that of Pass. This element takes effect only when the value of RedirectType is Mirror. Parent nodes: Set |
Value | String | Conditional This element must be specified if Set is specified. | The value of the header. The value can be up to 1,024 bytes in length and cannot contain \r\n . This element takes effect only when the value of RedirectType is Mirror. Parent nodes: Set |
Protocol | String | No | The protocol used for redirection. This element takes effect only when the value of RedirectType is External or AliCDN. For example, if you access an object named test, Protocol is set to https, and Hostname is set to example.com , the Location header value is https://example.com/test . Valid values: http and https. Parent nodes: Redirect |
HostName | String | No | The domain name used for redirection, which must comply with the naming conventions for domain names. For example, if you access an object named test, Protocol is set to https, and Hostname is set to example.com , the Location header value is https://example.com/test . Parent nodes: Redirect |
ReplaceKeyPrefixWith | String | No | The string that is used to replace the prefix of the object name during redirection. If the prefix of the object is empty, this string precedes the object name. Note You can specify only one of the ReplaceKeyWith and ReplaceKeyPrefixWith nodes in a rule. For example, the object to access is abc/test.txt. If you set KeyPrefixEquals to abc/ and ReplaceKeyPrefixWith to def/, the Location header value is http://example.com/def/test.txt . Parent nodes: Redirect |
EnableReplacePrefix | Boolean | No | If this element is set to true, the prefix of object names is replaced with the value specified by ReplaceKeyPrefixWith. If this parameter is not specified or empty, the prefix of object names is truncated. Note When the ReplaceKeyWith element is not empty, the EnableReplacePrefix element cannot be set to true. Default value: false Parent nodes: Redirect |
ReplaceKeyWith | String | No | The string that is used to replace the requested object name when the request is redirected. This element can be set to a variable. The ${key} variable that indicates the object name in the request is supported. For example, the name of the object to access is test. If ReplaceKeyWith is set to prefix/${key}.suffix , the address specified by the Location header is http://example.com/prefix/test.suffix . Parent nodes: Redirect |
HttpRedirectCode | HTTP status code | No | The HTTP redirect code in the response. This element takes effect only when the value of RedirectType is External or AliCDN. Default value: 301. Valid values: 301, 302, and 307 Parent nodes: Redirect |