Help Center/ Object Storage Service/ SDK Reference/ BrowserJS/ Bucket APIs/ Custom Domain Names/ Configuring a Custom Domain Name for a Bucket
Updated on 2026-08-14 GMT+08:00

Configuring a Custom Domain Name for a Bucket

Function

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

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 periods (.) and hyphens (-) 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 attributes comply with those set in the first creation request.

Default value:

None

DomainName

String

Yes

Explanation:

Custom domain name.

Restrictions:

None

Value range:

None

Default value:

None

Name

String

Yes

Explanation:

Certificate name

Restrictions:

None

Value range:

The value can 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

CertificateType

str

No

Explanation:

Certificate type.

Restrictions:

The value is case sensitive.

Value range:

  • server: server certificate
  • server_sm: server SM certificate
  • client: client CA certificate

Default value:

If this parameter is not set, the default value server is used.

ENCCertificate

str

No

Explanation:

Content of the SM encryption certificate.

Restrictions:

Use escape characters \n or \r\n to replace line breaks.

Value range:

The value can contain 0 to 65,536 characters.

Default value:

N/A

ENCPrivateKey

str

No

Explanation:

Private encryption key of the SM certificate.

Restrictions:

  • Private keys protected by passwords cannot be uploaded.
  • Use escape characters \n or \r\n to replace line breaks.

Value range:

The value can contain 0 to 4,096 characters.

Default value:

N/A

DeleteCertificate

str

No

Explanation:

Certificate operation type, indicating whether to delete the certificate.

Restrictions:

N/A

Value range:

  • false: Upload the certificate.
  • true: Delete the certificate of the specified type.

Default value:

false

Responses

Table 2 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.