API | Operation | Description |
Setting bucket referer configuration | Sets a bucket referer allowlist or blocklist | |
Querying bucket referer configuration | Queries a bucket referer allowlist or blocklist |
cos.putBucketReferer({Bucket: 'examplebucket-1250000000', /* Required */Region: 'COS_REGION', /* Bucket region. Required */RefererConfiguration: {Status: 'Enabled',RefererType: 'White-List',DomainList: {Domains: ['*.qq.com','*.qcloud.com',]},EmptyReferConfiguration: 'Allow',}}, function(err, data) {console.log(err || data);});
Parameter | Description | Type | Required |
Bucket | Bucket for which the bucket policy is configured in the format: BucketName-APPID | String | Yes |
Region | Bucket region. For the enumerated values, see Regions and Access Domain Names | String | Yes |
RefererConfiguration | Hotlink protection configuration. For details, see PUT Bucket referer | Object | Yes |
- Status | Whether to enable hotlink protection. Enumerated values: Enabled , Disabled | String | Yes |
- RefererType | Hotlink protection type. Enumerated values: Black-List , White-List | String | Yes |
- DomainList | List of domain names in the blocklist/allowlist. Using a prefix to specify multiple domains is supported. Domain names and IPs with ports are supported. A wildcard (*) is supported for second-level or multi-level domains. | Object | Yes |
- - Domains | Domain names in the blocklist/allowlist. Format: '.qq.com' (one domain); ['.qq.com', '*.qcloud.com'] (multiple domains) | String\\Array | Yes |
- EmptyReferConfiguration | Whether to allow access with an empty referer. Enumerated values: Allow , Deny (default) | String | No |
function(err, data) { ... }
Parameter | Description | Type |
err | Object returned when an error (network error or service error) occurs. If the request is successful, this is null. For more information, see Error Codes | Object |
- statusCode | HTTP status code, such as 200, 403, and 404 | Number |
- headers | Headers | Object |
data | Content returned when the request is successful. If the request fails, this parameter is empty. | Object |
- statusCode | HTTP status code, such as 200, 403, and 404 | Number |
- headers | Headers | Object |
cos.getBucketReferer({Bucket: 'examplebucket-1250000000', /* Required */Region: 'COS_REGION', /* Bucket region. Required */}, function(err, data) {console.log(err || data);});
{"RefererConfiguration": {"Status": "Enabled","RefererType": "White-List","DomainList": {"Domains": ["*.qq.com","*.qcloud.com"]},"EmptyReferConfiguration": "Allow"},"statusCode": 200,"headers": {},}
Parameter | Description | Type | Required |
Bucket | Bucket for which the bucket policy is queried in the format: BucketName-APPID | String | Yes |
Region | String | Yes |
function(err, data) { ... }
Parameter | Description | Type |
err | Object returned when an error (network error or service error) occurs. If the request is successful, this parameter is empty. For more information, please see Error Codes. | Object |
data | Content returned when the request is successful. If the request fails, this parameter is empty. | Object |
- RefererConfiguration | Hotlink protection configuration. For details, see GET Bucket referer | Object |
- - Status | Whether hotlink protection is enabled. Enumerated values: Enabled , Disabled | String |
- - RefererType | Hotlink protection type. Enumerated values: Black-List , White-List | String |
- - DomainList | List of domain names in the blocklist/allowlist. Using a prefix to specify multiple domains is supported. Domain names and IPs with ports are supported. A wildcard (*) is supported for second-level or multi-level domains. | Object |
- - - Domains | Domain names in the blocklist/allowlist | Array |
- - EmptyReferConfiguration | Whether access with an empty referer is allowed. Enumerated values: Allow , Deny (default) | String |
Apakah halaman ini membantu?