域名配置并行更新
更新时间:2020-06-18
接口
本接口用于同时更新多个配置项,目前该接口支持的配置项有:
cacheTTL
cacheFullUrl
ipACL
refererACL
https
requestAuth
followProtocol
rangeSwitch
cors
dsa
seoSwitch
mediaDragConf
origin
httpHeader
clientIp
errorPage
fileTrim
mobileAccess
accessLimit
compress
trafficLimit
Method | Path | 说明 |
---|---|---|
PUT | /v2/domain/{domain}/config?multiConfigs | 多配置更新接口 |
domain:修改配置的CDN加速域名。
请求体(Request Body)
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
multiConfigs | 必选 | list<config> | 其中config为单项配置,同单配置项接口参数。注意:cacheFullUrl配置参数需要在单项配置参数外面再套一个cacheFullUrl,详情见请求示例2 |
响应码 (Http Status Code)
HTTP Status Code | 说明 |
---|---|
200 | 成功 |
400 | 更新失败,参数错误等 |
请求示例1——更新源站配置
PUT /v2/domain/myself.baidu.com/config?multiConfigs HTTP/1.1
Host: cdn.baidubce.com
Content-Length: 118
Content-Type: text/json;utf-8
{
"multiConfigs": {
"origin": [
{
"peer": "http:\/\/[2001:da8:1:100::13]:80",
"host": "ipv6.tsinghua.edu.cn"
},
{
"peer": "https:\/\/222.111.8.205",
"host": "ipv6.tsinghua.edu.cn",
"backup": true
}
]
}
}
响应示例1
HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Sun, 09 Feb 2020 11:34:30 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.6.36
x-bce-request-id: dcecbaaa-7e81-add-171a-93e988b87ed5
{"status":"RUNNING"}
请求示例2——同时更新源站配置和缓存参数过滤规则配置
PUT /v2/domain/myself.baidu.com/config?multiConfigs HTTP/1.1
Host: cdn.baidubce.com
Content-Length: 218
Content-Type: text/json;utf-8
{
"multiConfigs": {
"origin": [
{
"peer": "http:\/\/[2001:da8:1:100::13]:80",
"host": "ipv6.tsinghua.edu.cn"
},
{
"peer": "https:\/\/222.111.8.205",
"host": "ipv6.tsinghua.edu.cn",
"backup": true
}
],
"cacheFullUrl": {
"cacheFullUrl": false,
"cacheUrlArgs": [
"a",
"b"
]
}
}
}
响应示例2
HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Sun, 09 Feb 2020 11:34:30 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.6.36
x-bce-request-id: dcecbaaa-7e81-add-171a-93e988b87ed5
{"status":"RUNNING"}
请求示例3——同时更新所有配置
PUT /v2/domain/myself.baidu.com/config?multiConfigs HTTP/1.1
Host: cdn.baidubce.com
Content-Length: 218
Content-Type: text/json;utf-8
{
"multiConfigs": {
"origin": [
{
"peer": "111.111.8.205",
"host": "ipv6.tsinghua.edu.cn"
}
],
"cacheTTL": [
{
"type": "suffix",
"value": ".jpg",
"ttl": 3600,
"weight": 10
}
],
"cacheFullUrl": {
"cacheFullUrl": false,
"cacheUrlArgs": [
"a",
"b"
]
},
"ipACL": {
"blackList": [
"1.1.1.2",
"1.1.1.3"
]
},
"refererACL": {
"blackList": [
"www.xxx.com",
".abcde.com."
],
"allowEmpty": true
},
"https": {
"enabled": false
},
"requestAuth": {
"type": "A",
"key1": "JFSDKFJLS",
"key2": "JLFS2fjkd",
"timeout": 1800,
"timestampMetric": 10
},
"followProtocol": true,
"rangeSwitch": true,
"cors": {
"allow": "on",
"originList": [
"http:\/\/www.baidu.com",
"http:\/\/*.bce.com"
]
},
"dsa": {
"enabled": true,
"rules": [
{
"type": "suffix",
"value": ".mp4;.jpg;.php"
},
{
"type": "path",
"value": "\/path"
},
{
"type": "exactPath",
"value": "\/path\/to\/file.mp4"
}
],
"comment": "test"
},
"httpHeader": [
{
"type": "origin",
"header": "x-auth-cn",
"value": "xxxxxxxxx",
"action": "add"
},
{
"type": "response",
"header": "content-type",
"value": "application\/octet-stream",
"action": "add"
}
],
"seoSwitch": {
"diretlyOrigin": "ON",
"pushRecord": "OFF"
},
"clientIp": {
"enabled": true,
"name": "X-Real-IP"
},
"errorPage": [
{
"code": 404,
"redirectCode": 302,
"url": "\/customer_404.html"
}
],
"mediaDragConf": {
"mp4": {
"fileSuffix": [
"mp4",
"m4a"
],
"startArgName": "startIndex",
"dragMode": "second"
},
"flv": {
"dragMode": "byteAV"
}
},
"fileTrim": true,
"mobileAccess": {
"distinguishClient": true
},
"accessLimit": {
"enabled": true,
"limit": 200
},
"compress": {
"allow": true,
"type": "br"
},
"trafficLimit": {
"enable": true,
"limitRate": 10485760,
"limitStartHour": 10,
"limitEndHour": 19,
"limitRateAfter": 0,
"trafficLimitArg": "rate",
"trafficLimitUnit": "m"
},
}
}
响应示例3
HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Sun, 09 Feb 2020 11:34:30 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.6.36
x-bce-request-id: dcecbaaa-7e81-add-171a-93e988b87ed5
{"status":"RUNNING"}