百度智能云

All Product Document

          CDN Abroad

          Set ip Access Rule Interface

          Interface

          This interface is used to set IP access rules.

          Method Path Description
          PUT /v2/abroad/domain/{domain}/config?ipACL Set the accessed ip control

          Request Body

          Parameter Optional Type Description
          ipACL Required ipACL Set ip access rules
          • ipACL field description:
          Parameter Optional Type Description
          whiteList Required String list The IP whitelist contains the IP address range in CIDR format
          blackList Required String list The IP blacklist can contain the IP address range in CIDR format
          • blackList and whiteList cannot exist at the same time.

          Response code(Http Status Code)

          Http Status Code Description
          200 Successfully configured
          400 Format error

          Request example 1: Set an IP Whitelist

          PUT /v2/abroad/domain/test.bcecdn.com/config?ipACL HTTP/1.1
          Host: cdn.baidubce.com
          User-Agent: curl/7.73.0
          Accept: */*
          Authorization: bce-auth-v1/e2824756xxxx4718add0cd7e7db47101/2021-03-05T09:04:01Z/1800/host/f55efb709f63ccda8c4619cee52efaf443ce929422c1c713007330bf3a3ad433
          x-bce-date: 2021-03-05T09:04:01Z
          x-bce-request-id: 4d0826ef-2296-4b46-bf46-18d6285024c8
          Content-Length: 67
          Content-Type: application/x-www-form-urlencoded
          {
               "ipACL": {        
                  "whiteList": ["1.1.1.1"] 
              }
          }

          Request example 2: Set IP blacklist

          PUT /v2/abroad/domain/test.coding365x24.com/config?ipACL HTTP/1.1
          Host: cdn.baidubce.com
          User-Agent: curl/7.73.0
          Accept: */*
          Authorization: bce-auth-v1/e2824756cd114718add0cd7e7db47101/2021-03-05T09:12:56Z/1800/host/7b96ec731cc8fe68f323169a8d6cf6489aab84692e280e4b78a98ee2479fc07c
          x-bce-date: 2021-03-05T09:12:56Z
          x-bce-request-id: 19a4c10c-cd81-4dda-9dda-bcfbd645998e
          Content-Length: 90
          Content-Type: application/x-www-form-urlencoded
          {
               "ipACL": {        
                  "blackList": ["1.1.1.1", "64.8.12.3/24"]        
              }	    }
          }

          Response example

          HTTP/1.1 200 OK
          Server: nginx/1.12.0
          Date: Fri, 05 Mar 2021 09:05:22 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: 4d0826ef-2296-4b46-bf46-18d6285024c8
          {"requestId":"4d0826ef-2296-4b46-bf46-18d6285024c8","code":"success","message":"update ip acl success"}
          Previous
          Set the Access Referer Control
          Next
          Set Forward-to-origin Host