Updated on 2026-07-22 GMT+08:00

Configuring a Custom Domain Name for a Bucket (SDK for Node.js)

Function

This API sets a custom domain name for an OBS bucket.

If you have any questions during development, post them on the Issues page of GitHub.

Restrictions

Method

ObsClient.setBucketCustomDomain(params)

Request Parameters

Table 1 List of request parameters

Parameter

Type

Mandatory (Yes/No)

Description

Bucket

String

Yes

Explanation:

Bucket name

Restrictions:

  • A bucket name must be unique across all accounts and regions.
  • A bucket name:
    • Must be 3 to 63 characters long and start with a digit or letter. Lowercase letters, digits, hyphens (-), and periods (.) are allowed.
    • Cannot be formatted as an IP address.
    • Cannot start or end with a hyphen (-) or period (.).
    • Cannot contain two consecutive periods (..), for example, my..bucket.
    • Cannot contain a period (.) and a hyphen (-) adjacent to each other, for example, my-.bucket or my.-bucket.
  • If you repeatedly create buckets with the same name in the same region, no error will be reported and the bucket properties comply with those set in the first creation request.

Default value:

None

DomainName

String

No

Explanation:

Custom domain name

Restrictions:

None

Value range:

None

Default value:

None

DomainBody

CustomDomainCertificateConfig

No

Explanation:

Custom domain name certificate configuration

Restrictions:

Only HTTPS requests are supported.

Value range:

CustomDomainCertificateConfig

Default value:

None

Table 2 CustomDomainCertificateConfig

Parameter

Type

Mandatory (Yes/No)

Description

Name

String

Yes

Explanation:

Certificate name

Restrictions:

None

Value range:

The value must contain 3 to 63 characters.

Default value:

None

CertificateId

String

No

Explanation:

Certificate ID on the CCM

Restrictions:

None

Value range:

The value must contain 16 characters.

Default value:

None

Certificate

String

Yes

Explanation:

Certificate content, which can contain intermediate and root certificates. If CertificateChain contains a certificate chain, only the certificate itself will be extracted from Certificate. Use escape characters \n or \r\n to replace line breaks.

Restrictions:

None

Value range:

None

Default value:

None

CertificateChain

String

No

Explanation:

Certificate chain, which is optional and can be passed through the Certificate parameter. Use escape characters \n or \r\n to replace line breaks.

Restrictions:

None

Value range:

None

Default value:

None

PrivateKey

String

Yes

Explanation:

Private key of a certificate. An encrypted private key cannot be uploaded. Use escape characters \n or \r\n to replace line breaks.

Restrictions:

None

Value range:

None

Default value:

None

Responses

Table 3 Responses

Type

Description

Table 4

NOTE:

This API returns a Promise response, which requires the Promise or async/await syntax.

Explanation:

Returned results. For details, see Table 4.

Table 4 Response

Parameter

Type

Description

CommonMsg

ICommonMsg

Explanation:

Common information generated after an API call is complete, including the HTTP status code and error code. For details, see Table 5.

InterfaceResult

Table 6

Explanation:

Results returned for a successful call. For details, see Table 6.

Restrictions:

This parameter is left blank if the value of Status is greater than 300.

Table 5 ICommonMsg

Parameter

Type

Description

Status

number

Explanation:

HTTP status code returned by the OBS server.

Value range:

A status code is a group of digits indicating the status of a response. It ranges from 2xx (indicating successes) to 4xx or 5xx (indicating errors). For details, see Status Codes.

Code

string

Explanation:

Error code returned by the OBS server.

Message

string

Explanation:

Error description returned by the OBS server.

HostId

string

Explanation:

Request server ID returned by the OBS server.

RequestId

string

Explanation:

Request ID returned by the OBS server.

Id2

string

Explanation:

Request ID2 returned by the OBS server.

Indicator

string

Explanation:

Error code details returned by the OBS server.

Table 6 BaseResponseOutput

Parameter

Type

Description

RequestId

string

Explanation:

Request ID returned by the OBS server