You need to enable JavaScript to run this app.
文档中心
对象存储

对象存储

复制全文
下载 pdf
静态网站托管
GetBucketWebsite
复制全文
下载 pdf
GetBucketWebsite
功能描述​
此接口用于获取指定存储空间(Bucket)的网站配置。​
注意事项​
调用此接口您必须为桶所有者,或被授权当前桶的 GetBucketWebsite 权限。​
请求消息样式​
​
GET /?website HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 08:05:36 +0000​
Authorization: authorization string​
​
请求参数和消息头​
该请求使用的公共请求消息头,请参见公共参数。​
​
名称​
位置​
参数类型​
是否必选​
示例值​
说明​
website​
Query​
String​
是​
-​
代表 GetBucketWebsite 请求的特殊标识。​
​
请求元素​
该请求不使用消息元素。​
响应消息头​
该请求返回的公共响应消息头,请参见公共参数。​
响应元素​
重定向所有请求​
​
名称​
参数类型​
示例值​
说明​
RedirectAllRequestsTo​
Object​
-​
重定向所有请求,设置后不能再设置其他重定向规则。​
HostName​
String​
example.com​
重定向的站点名。​
父节点:RedirectAllRequestsTo​
Protocol​
String​
http​
重定向请求时使用的协议,支持 http 和 https 协议。默认使用 http 协议。​
父节点:RedirectAllRequestsTo​
​
重定向规则​
  • 默认主页 IndexDocument​
​
名称​
参数类型​
示例值​
说明​
IndexDocument​
Object​
-​
设置默认主页。​
Suffix​
String​
index.html​
访问目录请求时(结尾为 / ),返回该目录下的 Suffix 对象。例如 Suffix 设置为 index.html 后,访问 docment/ 时,则返回 document/index.html。​
父节点:IndexDocument​
ForbiddenSubDir​
Bool​
false​
是否支持转到子目录的默认主页,取值说明如下:​
  • false(默认):不支持跳转到子目录的默认首页。​
  • true:支持跳转到子目录的默认首页。​
父节点:IndexDocument​
​
  • 报错页面 ErrorDocument​
​
名称​
参数类型​
示例值​
说明​
ErrorDocument​
Object​
-​
设置报错页面。​
Key​
String​
error.html​
当出现 4xx 错误时,则返回该页面。​
父节点:ErrorDocument​
​
  • 重定向规则 RoutingRules​
​
名称​
参数类型​
示例值​
说明​
RoutingRules​
Array​
-​
设置重定向规则。​
Condition​
Object​
-​
设置重定向规则的匹配条件。只有当设置的条件全部匹配后,重定向规则才能生效。​
父节点:RoutingRules​
HttpErrorCodeReturnedEquals​
Integer​
404​
设置重定向生效时的 HTTP 错误码。例如设置 HttpErrorCodeReturnedEquals 为 404,那么当访问指定对象不存在时,规则生效。​
如果设置了 KeyPrefixEquals,则两个条件都匹配时,重定向规则才能生效。​
父节点:Condition​
KeyPrefixEquals​
String​
red/​
设置重定向规则生效时的对象名前缀。​
如果设置了HttpErrorCodeReturnedEquals,则两个条件都匹配时,重定向规则才能生效。​
父节点:Condition​
Redirect​
Object​
-​
设置重定向规则。​
父节点:RoutingRules​
HostName​
String​
example.com​
设置重定向的站点名。​
父节点:Redirect​
HttpRedirectCode​
Integer​
301​
跳转时返回的状态码,只能设置 3XX 的错误码,不能设置 300, 默认为 301。​
父节点:Redirect​
Protocol​
String​
http​
重定向请求时使用的协议,支持 http 和 https 协议。默认使用 http 协议。​
父节点:Redirect​
ReplaceKeyPrefixWith​
String​
redirect/​
重定向时使用的对象名前缀。​
不能与 ReplaceKeyWith 同时设置。​
父节点:Redirect​
ReplaceKeyWith​
String​
redirect.html​
重定向时使用的对象名。​
不能与 ReplaceKeyPrefixWith 同时设置。​
父节点:Redirect​
​
请求示例​
​
GET /?website HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 08:05:36 +0000​
Authorization: authorization string​
​
响应示例​
​
HTTP/1.1 200 OK​
Date: Fri, 30 Jul 2021 13:53:55 GMT​
Server: TosServer​
x-tos-id-2: 1e89f203jld00006-a444fd0​
x-tos-request-id: 1e89f203b2d00006-a444ed0​
Content-Length: 643​
​
{​
"IndexDocument": {​
"Suffix": "index.html"​
},​
"ErrorDocument": {​
"Key": "error.html"​
}​
}​
​
​
最近更新时间:2026.02.10 10:31:11
这个页面对您有帮助吗?
有用
有用
无用
无用