Updated on 2024-05-16 GMT+08:00

Configuring HTTPS Settings

Function

This API is used to configure HTTPS settings for an acceleration domain name. You can deploy the HTTPS settings on all CDN nodes to implement secure acceleration.

URI

PUT /v1.0/cdn/domains/{domain_id}/https-info

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

domain_id

Yes

String

Specifies the acceleration domain name ID. For details, see Querying Details About a Domain Name.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

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 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token.

The token 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 4 Request body parameters

Parameter

Mandatory

Type

Description

https

Yes

HttpInfoRequestBody object

Specifies the HTTPS settings.

Table 5 HttpInfoRequestBody

Parameter

Mandatory

Type

Description

cert_name

Yes

String

Specifies the certificate name. The value contains 3 to 32 characters.

https_status

Yes

Integer

Specifies whether to enable HTTPS. Possible values: 0: Disable HTTPS. The certificate and private key are not required. 1: Enable HTTPS and select Same as user for Origin Protocol. 2: Enable HTTPS and select HTTP for Origin Protocol. 3: Enable HTTPS and select HTTPS for Origin Protocol. The certificate and private key are required when you configure the certificate for the first time. You will need to specify the certificate and private key when you enable HTTPS, except that you have already configured the certificate and private key before.

certificate

No

String

Specifies the body of the certificate used by the HTTPS protocol. This parameter is not required if https_status is set to 0. The value is in PEM format. This parameter is required if https_status is set to 1 or 2 and you configure the certificate for the first time.

private_key

No

String

Specifies the private key used by the HTTPS protocol. This parameter is not required if https_status is set to 0. The value is in PEM format. This parameter is required if https_status is set to 1 or 2 and you configure the certificate for the first time.

http2

No

Integer

Specifies whether to use HTTP/2. Possible values: 1 (yes) and 0 (no).

certificate_type

No

Integer

Specifies the certificate type. Possible values: 1 (Huawei-managed certificate) and 0 (your own certificate). Default value: 0.

force_redirect_https

No

Integer

Specifies whether to forcibly redirect requests to HTTPS. Possible values: 0 (no) and 1 (yes). You are advised to use force_redirect_config to configure the settings.

force_redirect_config

No

ForceRedirect object

Specifies the forcible redirect settings.

Table 6 ForceRedirect

Parameter

Mandatory

Type

Description

switch

Yes

Integer

Specifies whether to enable forcible redirect. Possible values: 1 (enabled) and 0 (disabled).

redirect_type

No

String

Specifies the protocol to which requests are forcibly redirected. Possible values: http and https.

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

https

HttpInfoResponseBody object

Specifies the HTTPS settings.

Table 8 HttpInfoResponseBody

Parameter

Type

Description

https_status

Integer

Specifies whether to enable HTTPS. Possible values: 0: Disable HTTPS. The certificate and private key are not required. 1: Enable HTTPS and select Same as user for Origin Protocol on the CDN console. 2: Enable HTTPS and select HTTP for Origin Protocol on the CDN console. 3: Enable HTTPS and select HTTPS for Origin Protocol on the CDN console. The certificate and private key are required when HTTPS is enabled.

cert_name

String

Specifies the certificate name. The value contains 3 to 32 characters.

certificate

String

Specifies the certificate body.

private_key

String

Specifies the private key used by the HTTPS protocol. This parameter is not required if https_status is set to 0. The value is in PEM coding format.

certificate_type

Integer

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

force_redirect_https

Integer

Specifies whether forcible redirect is enabled. Possible values: 1 (yes) and 0 (no).

force_redirect_config

ForceRedirect object

Specifies the forcible redirect settings.

http2

Integer

Specifies whether to use HTTP/2. Possible values: 1 (yes) and 0 (no).

expiration_time

Long

Specifies the time when the certificate expires.

Table 9 ForceRedirect

Parameter

Type

Description

switch

Integer

Specifies whether to enable forcible redirect. Possible values: 1 (enabled) and 0 (disabled).

redirect_type

String

Specifies the protocol to which requests are forcibly redirected. Possible values: http and https.

Example Requests

PUT https://cdn.myhuaweicloud.com/v1.0/cdn/domains/ff8080**********************d71/https-info?enterprise_project_id=0

{
  "https" : {
    "http2" : 0,
    "certificate_type" : 0,
    "force_redirect_config" : {
      "redirect_type" : "http",
      "switch" : 1
    },
    "force_redirect_https" : 1,
    "https_status" : 2,
    "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" : {
    "http2" : 0,
    "certificate_type" : 0,
    "force_redirect_config" : {
      "redirect_type" : "http",
      "switch" : 1
    },
    "expiration_time" : 1636183290000,
    "force_redirect_https" : 2,
    "https_status" : 2,
    "cert_name" : "cdn_test_cert",
    "certificate" : "-----BEGIN CERTIFICATE----------END CERTIFICATE-----",
    "private_key" : ""
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.