You can call this operation to query the hotlink protection configurations for a bucket.

Request syntax

GET /? referer HTTP/1.1
Host: BucketName.oss.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Response elements

Element Type Description
RefererConfiguration Container

The container that contains the Referer configurations.

Parent node: none.

Child node: AllowEmptyReferer and RefererList.

AllowEmptyReferer Boolean

Specifies whether the Referer field can be left empty in an access request.

Valid values: true and false.

Parent node: RefererConfiguration.

RefererList Container

The container that contains the Referer whitelist.

Parent node: RefererConfiguration.

Child node: Referer.

Referer String

The specified Referer whitelist.

Parent node: RefererList.

Examples

Sample requests

Get /? referer HTTP/1.1
Host: oss-example.oss.aliyuncs.com  
Date: Thu, 13 Sep 2012 07:51:28 GMT
Authorization: OSS qn6qrrqxo2oawuk53otfjbyc: BuG4rRK+zNhH1AcF51NNHD39****
Sample success responses
  • Sample responses to requests that include the Referer elements
    HTTP/1.1 200
    x-oss-request-id: 534B371674E88A4D8906****
    Date: Thu, 13 Sep 2012 07:51:28 GMT
    Connection: keep-alive
    Content-Length: 218  
    Server: AliyunOSS
    <? xml version="1.0" encoding="UTF-8"? >
    <RefererConfiguration>
    <AllowEmptyReferer>true</AllowEmptyReferer >
        <RefererList>
            <Referer> http://www.aliyun.com</Referer>
            <Referer> https://www.aliyun.com</Referer>
            <Referer> http://www. *.com</Referer>
            <Referer> https://www.?.aliyuncs.com</Referer>
        </RefererList>
    </RefererConfiguration>
  • Sample responses to requests that exclude the Refer elements
    Note If the bucket has no Referer-related configurations, OSS returns the default AllowEmptyReferer value and an empty RefererList.
    HTTP/1.1 200
    x-oss-request-id: 534B371674E88A4D8906****
    Date: Thu, 13 Sep 2012 07:56:46 GMT
    Connection: keep-alive
    Content-Length: 308  
    Server: AliyunOSS
    <? xml version="1.0" encoding="UTF-8"? >
    <RefererConfiguration>
    <AllowEmptyReferer>true</AllowEmptyReferer >
    < RefererList />
    </RefererConfiguration>

SDKs

The SDKs of the GetBucketReferer operation for various programming languages are as follows:

Error code

Error code HTTP status code Description
NoSuchBucket 404 The error message returned because the specified bucket does not exist.
AccessDenied 403 The error message returned because you are not authorized to query the hotlink protection configurations of the bucket. Only the bucket owner can query the hotlink protection configurations of the bucket.