设置访问Referer控制
更新时间:2021-01-25
接口
本接口用于设置域名访问Referer配置。
Method | Path | 说明 |
---|---|---|
PUT | /v2/dsa/domain/{domain}/config?action=setRefererAcl | 设置访问Referer配置 |
domain: CDN加速域名
请求体(Request Body)
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
refererACL | 必选 | RefererACL参数项解释如下: - blackList:可选项,list类型,表示referer黑名单列表,支持使用通配符,不需要加protocol,如设置某个黑名单域名,设置为"www.xxx.com"形式即可,而不是"http://www.xxx.com"。 - whiteList:可选项,list类型,表示referer白名单列表,支持通配符,同样不需要加protocol。 - allowEmpty:必选项,Bool类型,表示是否允许空referer访问,默认为true即允许空referer访问。 |
访问Referer配置规则 |
注意:blackList和whiteList不可同时存在。
请求示例1——设置白名单
Plain Text
1PUT /v2/dsa/domain/myself.baidu.com/config?action=setRefererAcl HTTP/1.1
2Host: cdn.baidubce.com
3Content-Length: 78
4Content-Type: text/json;utf-8
5
6{
7 "refererAcl":{
8 "blackList":[
9 "www.xxx.com"
10 ],
11 "allowEmpty":true
12 }
13}
请求示例2——设置黑名单
Plain Text
1PUT /v2/dsa/domain/myself.baidu.com/config?action=setRefererAcl HTTP/1.1
2Host: cdn.baidubce.com
3Content-Length: 78
4Content-Type: text/json;utf-8
5
6{
7 "refererACL":{
8 "whiteList":[
9 "www.xxx.com",
10 "test.baidu.com"
11 ],
12 "allowEmpty":true
13 }
14}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Content-Length: 0
3Content-Type: application/json;utf-8
4x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
5Server: BCE-CDN
6
7{
8 "status":"RUNNING"
9}