百度智能云

All Product Document

          CDN

          Set the Access Referer Control

          Method Path Description
          PUT /v2/domain/{domain}/config?refererACL Set Referer access configuration

          domain: CDN accelerated domain name.

          Request body

          Parameter Optional Type Description
          refererACL Required RefererACL parameters are explained as follows::
          - blackList: Optional, list type, indicating the referer blacklist. Support the wildcard , and no protocol is required. For example, to set a blacklist domain name, you only set it as “www.xxx.com" instead of “http:// " www.xxx.com ".
          - whiteList: Optional, list type, indicating the referer whitelist. Support the wildcard
          , and no protocol is required.
          - allowEmpty: Required, Bool type, indicating whether null referer access is allowed; the null referer access is allowed if it defaults to be true.
          Access Referer configuration rules

          Note: blackList and whiteList cannot exist at the same time.

          Hotlink protection domain name matching rule

          • For the referer configuration of the existing stock, remain the matching policy unchanged. Only support fuzzy matching in the form of ‘.a.com/ `.
          • The matching method for the referer hotlink protection configuration of the New and Stock Update after December 6, 2019 is of domain name level, and supports to add wildcard character to match with the subdomain name, such as: *.test.com.
          • Protocol settings are not distinguished for Referer. You do not have to enter http: // or https: as the prefix. //,If you are configuring the address of http: //zoe.baidu.com, just enter zoe.baidu.com.

          Request example 1 - set whitelist

          PUT /v2/domain/myself.baidu.com/config?refererACL HTTP/1.1 
          Host: cdn.baidubce.com 
          Content-Length: 78
          Content-Type: text/json;utf-8   
          
          { 
              "refererACL":{ 
                  "blackList":[ 
                      "www.xxx.com",
                      "*.abcde.com" 
                  ], 
                  "allowEmpty":true 
              } 
          } 

          Request example 2 - set blacklist

          PUT /v2/domain/myself.baidu.com/config?refererACL HTTP/1.1 
          Host: cdn.baidubce.com 
          Content-Length: 78
          Content-Type: text/json;utf-8   
          
          { 
              "refererACL":{ 
                  "whiteList":[ 
                      "www.xxx.com",
                      "*.baidu.com" 
                  ], 
                  "allowEmpty":true 
              } 
          } 

          Response example

          HTTP/1.1 200 OK 
          Content-Length: 0
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN 
          
          { 
              "status":"RUNNING" 
          } 
          Previous
          Query IP Access Frequency Limit
          Next
          Query the Access Referer Control