Baidu AI Cloud
中国站

百度智能云

CDN

Set the Access IP Control

Interface

This interface is used to set the IP control of the domain name.

Method Path Description
PUT /v2/domain/{domain}/config?ipACL Set IP access configuration

domain:Modify the configured CDN acceleration domain name.

Request body

Parameter Optional Type Description
ipACL Required ipACL Access IP configuration rules

The ipACL types are as follows:

Parameter Optional Type Description
blackList Optional list IP blacklist, support IP segments in CIDR format
whiteList Optional list IP whitelist, support IP segments in CIDR format

blackList and whiteList cannot exist at the same time.

Response code (Http Status Code)

HTTP Status Code Description
200 Success
400 Update failures, parameter errors, etc.

Request example1

Set the IP blacklist, and CDN gets the client IP. If it finds that the client IP is included in the blacklist, it rejects the request. The following example shows setting “1.1.1.2 " and “1.1.1.3 " as 2 blacklisted IPs.

PUT /v2/domain/myself.baidu.com/config?ipACL HTTP/1.1 
Host: cdn.baidubce.com 
Content-Length: 45
Content-Type: text/json;utf-8
 
{ 
    "ipACL":{ 
        "blackList":[ 
            "1.1.1.2",
            "1.1.1.3"
        ] 
    } 
} 

Request example 2

Set the IP whitelist. CDN gets the client IP and finds the client IP is included in the whitelist, then it allows the request. The following example shows adding a CIDR IP to the whitelist.

PUT /v2/domain/myself.baidu.com/config?ipACL HTTP/1.1 
Host: cdn.baidubce.com 
Content-Length: 38
Content-Type: text/json;utf-8
 
{ 
    "ipACL":{ 
        "whiteList":[ 
            "1.2.3.4/24"
        ] 
    } 
} 

Response example

HTTP/1.1 200 OK 
Content-Type: application/json; charset=utf-8 
Transfer-Encoding: chunked 

{"status":"RUNNING"} 
Previous
Query Domain Name Speed Limit
Next
Query the Access IP Control