All Products
Search
Document Center

Object Storage Service:0033-00000002

Last Updated:Apr 29, 2024

Problem description

The required AllowEmptyReferer parameter is missing in the XML body of the PutBucketReferer request.

Causes

You initiated a PutBucketReferer request to configure hotlink protection, but the required AllowEmptyReferer parameter is missing in the XML body.

Examples

In the following PutBucketReferer request, the AllowEmptyReferer parameter is missing in the XML body.

PUT /?referer HTTP/1.1
Date: Fri, 24 Feb 2017 03:15:40 GMT
Content-Length: 322
Content-Type: application/xml
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Authorization: OSS qn6q**************:77Dv****************

<?xml version="1.0" encoding="UTF-8"?>
<RefererConfiguration>
  <AllowTruncateQueryString>false</AllowTruncateQueryString>
  <RefererList>
        <Referer>http://www.aliyun.com</Referer>
  </RefererList>
</RefererConfiguration>

Solutions

Add the required AllowEmptyReferer parameter to the XML body of the PutBucketReferer request. The parameter specifies whether to allow the requests whose Referer field is empty. Default value: true. Valid values:

  • true: allows requests whose Referer field is empty.

  • false: denies requests whose Referer field is empty.

The following sample code provides an example of a valid request:

PUT /?referer HTTP/1.1
Date: Fri, 24 Feb 2017 03:15:40 GMT
Content-Length: 322
Content-Type: application/xml
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Authorization: OSS qn6q**************:77Dv****************

<?xml version="1.0" encoding="UTF-8"?>
<RefererConfiguration>
  <AllowEmptyReferer>false</AllowEmptyReferer>
  <AllowTruncateQueryString>false</AllowTruncateQueryString>
  <RefererList>
        <Referer>http://www.aliyun.com</Referer>
  </RefererList>
</RefererConfiguration>

References