Help Center> Content Delivery Network> API Reference> API> Domain Name Configuration> Associating a Certificate with Multiple Domain Names
Updated on 2024-03-21 GMT+08:00

Associating a Certificate with Multiple Domain Names

Function

If you associate a certificate with multiple domain names, you need to set force redirect for the domain names.

URI

PUT /v1.0/cdn/domains/config-https-info

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

ID of the enterprise project that the domain name to be modified belongs to. This parameter is valid only when the enterprise project function is enabled. The value all indicates all projects. This parameter is mandatory when you use an IAM user to call this API.

Obtain the enterprise project ID by calling the ListEnterpriseProject API of Enterprise Project Management Service (EPS).

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

https

No

UpdateDomainMultiCertificatesRequestBodyContent object

HTTPS settings.

Table 4 UpdateDomainMultiCertificatesRequestBodyContent

Parameter

Mandatory

Type

Description

domain_name

Yes

String

Domain name list. Domain names are separated by commas (,). Up to 50 domain names are supported.

https_switch

Yes

Integer

HTTPS status. Possible values: 0 (disabled) and 1 (enabled). If https_switch is set to 1, the certificate parameters must be specified.

access_origin_way

No

Integer

Origin protocol. Possible values: 1 (same as user requests), 2 (HTTP, default value), and 3 (HTTPS).

force_redirect_https

No

Integer

Whether force HTTPS is enabled. Possible values: 0 (disabled, default value) and 1 (enabled). (This parameter is about to go offline. You are advised to use force_redirect_config.)

force_redirect_config

No

ForceRedirect object

Force redirect.

http2

No

Integer

HTTP/2 status. Possible values: 0 (disabled, default value) and 1 (enabled).

cert_name

No

String

Certificate name. This parameter is mandatory when a certificate is configured. The value contains 3 to 64 characters.

certificate

No

String

SSL certificate content used by HTTPS. Only the PEM format is supported. This parameter is mandatory only when a certificate is configured for the first time.

private_key

No

String

SSL certificate key used by HTTPS. Only the PEM format is supported. This parameter is mandatory only when a certificate is configured for the first time.

certificate_type

No

Integer

Certificate type. Possible values: 0 (your own certificate, default value) and 1 (Huawei-managed certificate). If you set this parameter to 1, you do not need to enter the certificate body and private key. The system automatically matches the certificate based on the certificate name.

Table 5 ForceRedirect

Parameter

Mandatory

Type

Description

switch

Yes

Integer

Force redirect status. 1 enabled. 0: disabled.

redirect_type

No

String

Protocol to which requests are forcibly redirected. Possible values: http and https.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

https

UpdateDomainMultiCertificatesResponseBodyContent object

HTTPS settings.

Table 7 UpdateDomainMultiCertificatesResponseBodyContent

Parameter

Type

Description

domain_name

String

Domain name list.

https_switch

Integer

HTTPS status. Possible values: 0 (disabled) and 1 (enabled). If you set this parameter to 1, a certificate must be configured.

access_origin_way

Integer

Origin protocol. Possible values: 1 (same as user requests), 2 (HTTP, default value), and 3 (HTTPS, only on Huawei nodes).

force_redirect_https

Integer

Force HTTPS status. Possible values: 0 (disabled) and 1 (enabled).

force_redirect_config

ForceRedirect object

Force redirect.

http2

Integer

HTTP/2 status. Possible values: 0 (disabled) and 1 (enabled).

cert_name

String

Certificate name.

certificate

String

Certificate content.

certificate_type

Integer

Certificate type. Possible values: 0 (your own certificate) and 1 (Huawei-managed certificate).

expiration_time

Long

Certificate expiration time.

Table 8 ForceRedirect

Parameter

Type

Description

switch

Integer

Force redirect status. 1 enabled. 0: disabled.

redirect_type

String

Protocol to which requests are forcibly redirected. Possible values: http and https.

Example Requests

{
  "https" : {
    "domain_name" : "example1.com",
    "access_origin_way" : 2,
    "http2" : 0,
    "certificate_type" : 0,
    "force_redirect_config" : {
      "redirect_type" : "https",
      "switch" : 1
    },
    "https_switch" : 1,
    "cert_name" : "cdn_test_cert",
    "certificate" : "-----BEGIN CERTIFICATE----------END CERTIFICATE-----",
    "private_key" : "-----BEGIN RSA PRIVATE KEY---------END RSA PRIVATE KEY-----"
  }
}

Example Responses

Status code: 200

OK

{
  "https" : {
    "domain_name" : "example1.com",
    "https_switch" : 1,
    "access_origin_way" : 2,
    "force_redirect_https" : 1,
    "force_redirect_config" : {
      "redirect_type" : "https",
      "switch" : 1
    },
    "http2" : 0,
    "expiration_time" : 1925791912000,
    "cert_name" : "cdn_test_cert",
    "certificate" : "-----BEGIN CERTIFICATE----------END CERTIFICATE-----",
    "certificate_type" : 0
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.