OBS PHP SDK-设置桶的Website配置:请求参数

时间:2025-02-12 14:52:37

请求参数

字段名

类型

约束

说明

Bucket

string

必选

桶名。

RedirectAllRequestsTo

associative array

可选

所有请求重定向规则。

  

HostName

string

必选

重定向请求时使用的站点名。

Protocol

string

可选

重定向请求时使用的协议,支持的值:

  • http(默认)
  • https

ErrorDocument

associative array

可选

错误页面配置。

  

Key

string

可选

指定当4XX错误出现时返回的页面。

IndexDocument

associative array

可选

默认页面配置。

  

Suffix

string

必选

该字段被追加在对文件夹的请求的末尾(例如:配置的是“index.html”,请求的是“samplebucket/images/”,返回的数据将是“samplebucket”桶内名为“images/index.html”的对象的内容)。该字段不能为空或者包含“/”字符。

RoutingRules

indexed array

可选

重定向规则列表。

  

Condition

associative array

可选

重定向规则的匹配条件。

  

HttpErrorCodeReturnedEquals

string

可选

重定向规则生效需要匹配的HTTP错误码。

KeyPrefixEquals

string

可选

重定向规则生效需要匹配的对象名前缀。

Redirect

associative array

必选

重定向请求时的具体信息。

  

Protocol

string

可选

重定向请求时使用的协议,支持的值:

  • http
  • https

HostName

string

可选

重定向请求时使用的站点名。

ReplaceKeyPrefixWith

string

可选

重定向请求时使用的对象名前缀。

ReplaceKeyWith

string

可选

重定向请求时使用的对象名。不可与ReplaceKeyPrefixWith同时存在。

HttpRedirectCode

string

可选

重定向请求时响应中的HTTP状态码。

  • ErrorDocument,IndexDocument和RoutingRules必须配套使用,且与RedirectAllRequestsTo互斥。当设置了这三个字段时,不能设置RedirectAllRequestsTo;反之,当设置了RedirectAllRequestsTo时,不能设置ErrorDocument,IndexDocument和RoutingRules。
  • 当ErrorDocument,IndexDocument和RoutingRules三个字段一起使用时,RoutingRules可为空。
  • ErrorDocument,IndexDocument、RoutingRules与RedirectAllRequestsTo不能全为空。
support.huaweicloud.com/api-obs_php_sdk_api_zh/obs_38_0325.html