Description
The GET Bucket referer API is used to read the bucket referer allowlist or blocklist.
Request
Request Example
GET /?referer HTTP 1.1
Host: <BucketName-APPID>.<Endpoint>
Date: GMT Date
Authorization: Auth String
Note:
Authorization: Auth String (For details, see Request Signature documentation).
Request Header
This API only uses common request headers. For details, see Common Request Headers documentation.
Request Body
The request body of this request is empty.
Response
Response Headers
This API only returns the public response header. For details, see Common Response Headers documentation.
Response Body
The response body is returned as application/xml data, and the content containing the complete node data is shown below.
<RefererConfiguration>
<Status>Enabled</Status>
<RefererType>White-List</RefererType>
<DomainList>
<Domain>*.domain1.com</Domain>
<Domain>*.domain2.com</Domain>
</DomainList>
<EmptyReferConfiguration>Allow</EmptyReferConfiguration>
</RefererConfiguration>
The data are as follows:
| Name | Parent Node | Description | Type | Required |
|---|---|---|---|---|
| RefererConfiguration | No | Anti-hotlinking configuration information | Container | Yes |
| Status | RefererConfiguration | Whether to enable hotlink protection. Enumerated values: Enabled and Disabled | String | Yes |
| RefererType | RefererConfiguration | Anti-hotlink type, enumeration value: Black-List, White-List | String | Yes |
| DomainList | RefererConfiguration | Valid domain name list. Supports multiple domain names (prefix matching). Supports domain names and IP addresses with ports. Supports the wildcard * for second-level domain names or multi-level domain names. |
Container | Yes |
| Domain | DomainList | A single valid domain, such as www.test.com/example, 192.168.1.2:8080, and *.test.com. |
String | Yes |
| EmptyReferConfiguration | RefererConfiguration | Whether to allow access with a null Referer. Enumeration value: Allow, Deny. The default value is Deny. | String | No |
Error Code
This request has no error. For all errors, see Error Codes documentation.
Practical Case
Request
GET /?referer HTTP 1.1
Host: <BucketName-APPID>.<Endpoint>
Date: Fri, 25 Feb 2017 04:10:22 GMT
Authorization:q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR****&q-sign-time=1547105134;32526689134&q-key-time=1547105134;32620001134&q-header-list=content-md5;content-type;host&q-url-param-list=referer&q-signature=0f7fef5b1d2180deaf6f92fa2ee0cf87ae83****
Response
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 260
Connection: keep-alive
Date: Fri, 25 Feb 2017 04:10:22 GMT
x-cos-request-id: NTg3ZjFjMmJfOWIxZjRlXzZmNDhf****
<RefererConfiguration>
<Status>Enabled</Status>
<RefererType>White-List</RefererType>
<DomainList>
<Domain>*.domain1.com</Domain>
<Domain>*.domain2.com</Domain>
</DomainList>
<EmptyReferConfiguration>Allow</EmptyReferConfiguration>
</RefererConfiguration>