Anti-leech settings

Last Updated: Jul 29, 2017

The OSS collects service fees based on use. To prevent users’ data on OSS from being leeched, OSS supports anti-leech based on the field referer in the HTTP header. Users can log in to OSS Console or use APIs to configure a referer white list for a bucket or whether to allow access by requests where referer is blank. For example, for a bucket named oss-example, set its referer white list to http://www.aliyun.com. Then, only requests with a referer of http://www.aliyun.com can access the objects in the bucket.

Detail analysis

  • Anti-leech verification will be performed only when users access objects through URL signatures or anonymously. When the request header contains the “Authorization” field, anti-leech verification is not performed.
  • A bucket supports multiple referer fields, which are separated by the comma “,”.
  • The referer field supports the wildcard “*“ and “?”。
  • Users can set whether to allow access requests with empty referer fields.
  • When the white list is empty, the system will not check if the referer field is null (otherwise, all requests will be rejected).
  • When the white list is not empty and the rules do not allow null referer fields, only requests with referers in the white list will be allowed. Other requests (including null referer requests) will be rejected.
  • If the white list is not empty and the rules allow empty referer fields, requests with empty referer and with the referers in the white list will be allowed. Other requests will be rejected.
  • The three bucket permissions (private, public-read, and public-read-write) will all check the referer field.

Wildcard details:

  • Asterisk “”: The asterisk can be used to represent 0 or multiple characters. If you are looking for an object name prefixed with AEW but have forgotten the remaining part, you can enter AEW* to search for all types of files starting with AEW, such as AEWT.txt, AEWU.EXE and AEWI.dll. If you want to narrow down the search scope, you can enter AEW*.txt to search for all .txt files starting with AEW, such as AEWIP.txt and AEWDF.txt.
  • Question mark “?”: The question mark can be used to represent one character. If you enter love?, all types of files starting with love and ending with one character will be displayed, such as lovey and lovei. If you want to narrow the search scope, you can enter love?.doc to search for all .doc files starting with love and ending with one character, such as lovey.doc and loveh.doc.

Reference for using the function

Thank you! We've received your feedback.