您可以通过 PutBucketCustomDomain 为存储桶(Bucket)绑定自定义域名,绑定后,您可以通过该域名访问存储桶内资源。
PUT /?customdomain HTTP/1.1
Host: bucketname.tos-cn-beijing.volces.com
Date: Fri, 30 Jul 2021 08:05:36 +0000
Authorization: authorization string
Content-Length: 89
{
"CustomDomainRule": {
"Domain": "example.com",
"CertId": "certID"
}
}
该请求使用的公共请求消息头,请参见公共参数。
名称 | 位置 | 参数类型 | 是否必选 | 示例值 | 说明 |
---|---|---|---|---|---|
customdomain | Query | String | 是 | - | 代表 PutBucketCustomDomain请求的特殊标识。 |
名称 | 参数类型 | 是否必选 | 示例值 | 说明 |
---|---|---|---|---|
CustomDomainRule | Container | 是 | - | 设置自定义域名信息。 |
Domain | String | 是 | example.com | 需要绑定的自定义域名。 |
CertId | String | 否 | cert-9228928537e540f9a6a2fc844672**** | 证书 ID。 |
Protocol | String | 否 | tos | 自定义域名的访问协议,取值说明如下:
|
该请求返回的公共响应消息头,请参见公共参数。
该请求响应中无消息元素。
PUT /?customdomain HTTP/1.1
Host: bucketname.tos-cn-beijing.volces.com
Date: Fri, 30 Jul 2021 08:05:36 +0000
Authorization: authorization string
Content-Length: 64
{
"CustomDomainRule": {
"Domain": "example.com",
"Protocol": "tos"
}
}
HTTP/1.1 200 OK
x-tos-id-2: f91b0c03a01300c1-a444ed0
x-tos-request-id: f91b0c03a01300c1-a444ed0
Date: Fri, 30 Jul 2021 06:45:39 GMT
server: TosServer
PUT /?customdomain HTTP/1.1
Host: bucketname.tos-cn-beijing.volces.com
Date: Fri, 30 Jul 2021 08:05:36 +0000
Authorization: authorization string
Content-Length: 89
{
"CustomDomainRule": {
"Domain": "example.com",
"CertId": "certID"
}
}
HTTP/1.1 200 OK
x-tos-id-2: f91b0c03a01300c1-a444ed0
x-tos-request-id: f91b0c03a01300c1-a444ed0
Date: Fri, 30 Jul 2021 06:45:39 GMT
server: TosServer