Blocks specified URLs on CDN edge nodes. Requests sent to blocked URLs are denied and trigger the HTTP 403 status code.

Note
  • The maximum number of times that each user can call this operation per second is 20.
  • This operation is available only to users on the whitelist. If the daily peak bandwidth values of your workloads exceed 100 Gbit/s. you can submit a ticket to apply for permissions. Alibaba Cloud will review your application and then grant you permissions based on your business requirements.
  • This operation supports only the POST request method. Parameters must be submitted in forms.
Rules for blocking URLs
  • Exact match based on query strings is supported

    For example, if the URL that is blocked is http://www.example.com/abc.html?a=1&b=1, only requests that are sent to http://www.example.com/abc.html?a=1&b=1 are denied. Requests are allowed to access URLs that carry different query strings, such as http://www.example.com/abc.html?a=1&b=2.

  • Parameters filtering is supported

    If parameter filtering is enabled, and the URL that is blocked is http://www.example.com/abc.html, requests are matched against http://www.example.com/abc.html regardless of the query string. If the destination URL of a request matches http://www.example.com/abc.html, the request is denied. For example, all the following URLs are considered matches and blocked: http://www.example.com/abc.html, http://www.example.com/abc.html?a=1, http://www.example.com/abc.html?a=2, and http://www.example.com/abc.html?a=1&b=1.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes BlockObjectCaches

The operation that you want to perform. Set the value to BlockObjectCaches.

ObjectPath String Yes example.com/image/1.png

The URLs that you want to block. Separate URLs with line feeds (\n or \r\n).

Note
  • You can submit at most 100 URLs to be blocked or unblocked in each call.
  • Each Alibaba Cloud account can submit at most 100 URLs to be blocked or unblocked per day.
Type String Yes block

The operation type. Valid values:

  • block: blocks URLs
  • unblock: unblocks URLs
Maxage Integer No 86400

The period of time that the URLs remain blocked.

  • Valid values: 600 to 864000.
  • Unit: seconds.
  • If you do not specify a value, the URLs remain blocked for 90 days.

Response parameters

Parameter Type Example Description
BlockTaskId String 704222904

The ID of the block task. If multiple tasks are returned, the IDs are separated by commas (,).

RequestId String D61E4801-EAFF-4A63-AAE1-FBF6CE1CFD1C

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=BlockObjectCaches
&ObjectPath=example.com/image/1.png
&Type=block
&<Common request parameters>

Sample success responses

XML format

<BlockObjectCachesResponse>
  <RequestId>D61E4801-EAFF-4A63-AAE1-FBF6CE1CFD1C</RequestId>
  <BlockTaskId>704222904</BlockTaskId>
</BlockObjectCachesResponse>

JSON format

null

Error codes

HttpCode Error code Error message Description
400 QuotaExceeded.Refresh You've exceeded the prescribed refresh limits. The error message returned because the quota for refresh on the current day has exhausted. You can no longer perform the refresh operation on the current day. You can call the DescribeDcdnRefreshQuota operation to query the remaining quota of refresh requests for the current day.
400 InvalidObjectPath.Malformed The specific value of parameter ObjectPath is malformed. The error message returned because the value of the ObjectPath parameter is in an invalid format. Example: example.com/image/1.png. Separate URLs with line feeds (\n or \r\n).
400 InvalidExtensiveDomain.ValueNotSupported Extensive domain not supported. The error message returned because this operation does not support wildcard domain names.

For a list of error codes, visit the API Error Center.