Set HTTPS Acceleration
Interface
This interface is used to set HTTPS acceleration related options, and it is a full configuration interface.
Method | Path | Description |
---|---|---|
PUT | /v2/domain/{domain}/config?https | Configure HTTPS acceleration |
domain: CDN accelerated domain name.
Request body
Parameter | Optional | Type | Description |
---|---|---|---|
https | Required | HTTPSConfig | HTTPS configuration information |
The HTTPSConfig types are as follows:
Parameter | Optional | Type | Description |
---|---|---|---|
enabled | Required | Bool | Enable HTTPS acceleration. The default is false. When enabled=false, the following fields are invalid. (When certId=“”, the certId field is valid.) |
certId | Optional | String | This item is required when enabled=true, and it is the certificate ID returned by the SSL certificate service. When enabled is false and certId is " ", unbind the certId currently bound to the domain, otherwise this item is invalid when enabled=False. |
httpRedirect | Optional | Bool | When enabled is true, redirect HTTP requests to HTTPS (the redirection status code is configured by httpRedirectCode), and the default is false. When enabled=false, this item is invalid, and httpsRedirect and it cannot be true at the same time. |
httpRedirectCode | Optional | Int | Redirection status code, you can select 301/302, and the default is 302. When enabled=false, this item is invalid; when httpRedirect=false, this item is invalid. |
httpsRedirect | Optional | Bool | When enabled is true, redirect HTTP requests to HTTPS (the redirection status code is configured by httpRedirectCode), and the default is false. When enabled=false, this item is invalid, and httpsRedirect and it cannot be true at the same time. |
httpsRedirectCode | Optional | Int | Redirection status code, you can select 301/302, and the default is 302. When enabled=false, this item is invalid; when httpsRedirect=false, this item is invalid. |
http2Enabled | Optional | Bool | Enable HTTP2 feature, and the default is true. When enabled=false, this item is invalid. |
httpOrigin | Optional | Bool | When it is true, forward to origin with HTTP protocol, and the default is false. When enabled=false, this item is invalid. |
sslVersion | Optional | String | Set TLS version, it defaults to support the versions from TLSv1.0 to TLSv1.3, or set to be one of the following four version, namely SSLV3, TLSV1, TLSV11 and TLSV12; when enabled=false, it is invalid. It usually takes the default value, without setting |
Response code (Http Status Code)
HTTP Status Code | Description |
---|---|
200 | Success |
400 | Update failures, parameter errors, etc. |
Request example1
Enable HTTPS, certId is “ssl-82fdaufdsaldsuaow ", and other properties follow the default values. HTTP request will not be redirected to HTTPS, and HTTPS request will not be redirected to HTTP; HTTP2 feature is enabled to support all TLS versions with HTTPS protocol to forward to origin, including TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.
PUT /v2/domain/myself.baidu.com/config?https HTTP/1.1
Host: cdn.baidubce.com
Content-Length: 59
Content-Type: text/json;utf-8
{
"https": {
"enabled": true,
"certId": "ssl-82fdaufdsaldsuaow"
}
}
Request example 2
Enable HTTPS, certId is “ ssl-82fdaufdsaldsuaow ", redirect HTTP requests to HTTPS, and the redirection status code is 301. Disable HTTP2 feature. Other attribute follows the default value, which will not redirect the HTTPS request to HTTP; forward to origin with HTTPS protocol, and all the TLS versions are supported, including TLSv1.0, TLSv1.1, TLSv1.2 and TLSv1.3.
PUT /v2/domain/myself.baidu.com/config?https HTTP/1.1
Host: cdn.baidubce.com
Content-Length: 123
Content-Type: text/json;utf-8
{
"https":{
"enabled":true,
"certId":"ssl-82fdaufdsaldsuaow",
"httpRedirect":true,
"httpRedirectCode":301,
"http2Enabled":false
}
}
Request example3
Disable HTTPS. Other options are meaningless.
PUT /v2/domain/myself.baidu.com/config?https HTTP/1.1
Host: cdn.baidubce.com
Content-Length: 27
Content-Type: text/json;utf-8
{
"https":{
"enabled": false
}
}
Response example
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 26 Jun 2019 05:57:29 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.1.5
x-bce-request-id: 8a9c4d38-5198-ed4e-b279-272fdde46e4b
{
"status":"RUNNING"
}