域名配置并行更新
更新时间: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——更新源站配置
Text
1PUT /v2/domain/myself.baidu.com/config?multiConfigs HTTP/1.1
2Host: cdn.baidubce.com
3Content-Length: 118
4Content-Type: text/json;utf-8
5
6{
7 "multiConfigs": {
8 "origin": [
9 {
10 "peer": "http:\/\/[2001:da8:1:100::13]:80",
11 "host": "ipv6.tsinghua.edu.cn"
12 },
13 {
14 "peer": "https:\/\/222.111.8.205",
15 "host": "ipv6.tsinghua.edu.cn",
16 "backup": true
17 }
18 ]
19 }
20}
响应示例1
Text
1HTTP/1.1 200 OK
2Server: nginx/1.14.0
3Date: Sun, 09 Feb 2020 11:34:30 GMT
4Content-Type: application/json; charset=utf-8
5Transfer-Encoding: chunked
6Connection: keep-alive
7X-Powered-By: PHP/5.6.36
8x-bce-request-id: dcecbaaa-7e81-add-171a-93e988b87ed5
9
10{"status":"RUNNING"}
请求示例2——同时更新源站配置和缓存参数过滤规则配置
Text
1PUT /v2/domain/myself.baidu.com/config?multiConfigs HTTP/1.1
2Host: cdn.baidubce.com
3Content-Length: 218
4Content-Type: text/json;utf-8
5
6{
7 "multiConfigs": {
8 "origin": [
9 {
10 "peer": "http:\/\/[2001:da8:1:100::13]:80",
11 "host": "ipv6.tsinghua.edu.cn"
12 },
13 {
14 "peer": "https:\/\/222.111.8.205",
15 "host": "ipv6.tsinghua.edu.cn",
16 "backup": true
17 }
18 ],
19 "cacheFullUrl": {
20 "cacheFullUrl": false,
21 "cacheUrlArgs": [
22 "a",
23 "b"
24 ]
25 }
26 }
27}
响应示例2
Text
1HTTP/1.1 200 OK
2Server: nginx/1.14.0
3Date: Sun, 09 Feb 2020 11:34:30 GMT
4Content-Type: application/json; charset=utf-8
5Transfer-Encoding: chunked
6Connection: keep-alive
7X-Powered-By: PHP/5.6.36
8x-bce-request-id: dcecbaaa-7e81-add-171a-93e988b87ed5
9
10{"status":"RUNNING"}
请求示例3——同时更新所有配置
Text
1PUT /v2/domain/myself.baidu.com/config?multiConfigs HTTP/1.1
2Host: cdn.baidubce.com
3Content-Length: 218
4Content-Type: text/json;utf-8
5
6{
7 "multiConfigs": {
8 "origin": [
9 {
10 "peer": "111.111.8.205",
11 "host": "ipv6.tsinghua.edu.cn"
12 }
13 ],
14 "cacheTTL": [
15 {
16 "type": "suffix",
17 "value": ".jpg",
18 "ttl": 3600,
19 "weight": 10
20 }
21 ],
22 "cacheFullUrl": {
23 "cacheFullUrl": false,
24 "cacheUrlArgs": [
25 "a",
26 "b"
27 ]
28 },
29 "ipACL": {
30 "blackList": [
31 "1.1.1.2",
32 "1.1.1.3"
33 ]
34 },
35 "refererACL": {
36 "blackList": [
37 "www.xxx.com",
38 ".abcde.com."
39 ],
40 "allowEmpty": true
41 },
42 "https": {
43 "enabled": false
44 },
45 "requestAuth": {
46 "type": "A",
47 "key1": "JFSDKFJLS",
48 "key2": "JLFS2fjkd",
49 "timeout": 1800,
50 "timestampMetric": 10
51 },
52 "followProtocol": true,
53 "rangeSwitch": true,
54 "cors": {
55 "allow": "on",
56 "originList": [
57 "http:\/\/www.baidu.com",
58 "http:\/\/*.bce.com"
59 ]
60 },
61 "dsa": {
62 "enabled": true,
63 "rules": [
64 {
65 "type": "suffix",
66 "value": ".mp4;.jpg;.php"
67 },
68 {
69 "type": "path",
70 "value": "\/path"
71 },
72 {
73 "type": "exactPath",
74 "value": "\/path\/to\/file.mp4"
75 }
76 ],
77 "comment": "test"
78 },
79 "httpHeader": [
80 {
81 "type": "origin",
82 "header": "x-auth-cn",
83 "value": "xxxxxxxxx",
84 "action": "add"
85 },
86 {
87 "type": "response",
88 "header": "content-type",
89 "value": "application\/octet-stream",
90 "action": "add"
91 }
92 ],
93 "seoSwitch": {
94 "diretlyOrigin": "ON",
95 "pushRecord": "OFF"
96 },
97 "clientIp": {
98 "enabled": true,
99 "name": "X-Real-IP"
100 },
101 "errorPage": [
102 {
103 "code": 404,
104 "redirectCode": 302,
105 "url": "\/customer_404.html"
106 }
107 ],
108 "mediaDragConf": {
109 "mp4": {
110 "fileSuffix": [
111 "mp4",
112 "m4a"
113 ],
114 "startArgName": "startIndex",
115 "dragMode": "second"
116 },
117 "flv": {
118 "dragMode": "byteAV"
119 }
120 },
121 "fileTrim": true,
122 "mobileAccess": {
123 "distinguishClient": true
124 },
125 "accessLimit": {
126 "enabled": true,
127 "limit": 200
128 },
129 "compress": {
130 "allow": true,
131 "type": "br"
132 },
133 "trafficLimit": {
134 "enable": true,
135 "limitRate": 10485760,
136 "limitStartHour": 10,
137 "limitEndHour": 19,
138 "limitRateAfter": 0,
139 "trafficLimitArg": "rate",
140 "trafficLimitUnit": "m"
141 },
142 }
143}
响应示例3
Text
1HTTP/1.1 200 OK
2Server: nginx/1.14.0
3Date: Sun, 09 Feb 2020 11:34:30 GMT
4Content-Type: application/json; charset=utf-8
5Transfer-Encoding: chunked
6Connection: keep-alive
7X-Powered-By: PHP/5.6.36
8x-bce-request-id: dcecbaaa-7e81-add-171a-93e988b87ed5
9
10{"status":"RUNNING"}