PushObjectCache

Updated at:
Copy as MD

Prefetches content from the origin server to cache nodes. This allows first-time access to directly hit the cache, reducing the load on the origin server.

Operation description

  • Request method: POST requests are supported. Parameters are displayed in a form.

  • Related operations: The refresh and prefetch operations include the RefreshObjectCaches refresh operation and the PushObjectCache prefetch operation.

  • Daily URL prefetch quota: By default, each account can submit up to 1,000 URL prefetch tasks per day. If the daily peak bandwidth of your account exceeds 200 Mbit/s, you can submit a ticket to request a higher daily quota. Alibaba Cloud evaluates and configures the quota based on your actual business requirements.

  • You can submit up to 100 URL prefetch tasks at a time.

  • Prefetch queue rules: The maximum prefetch queue size for each account is 100,000 URLs. CDN prefetches URLs in the order in which they are submitted. When the number of URLs pending prefetch in the queue reaches 100,000, CDN rejects new prefetch tasks.

  • Maximum number of times that each user can call this operation per second: 50.

  • To automate refresh or prefetch tasks, refer to Scripts for Refresh and Prefetch.

Before you begin

  • After a prefetch node is submitted and successfully executed, points of presence immediately perform origin fetch to load the required resources. Submitting a large number of prefetch nodes generates many concurrent download nodes, which causes a surge in origin fetch bandwidth and requests and increases the load on the origin server.

  • The actual execution time of a prefetch node from commit to completion depends on the size of the prefetched file and typically takes 5 to 30 minutes. The smaller the average file size, the faster the prefetch.

  • To use a Resource Access Management (RAM) user to perform refresh or prefetch operations, obtain the required authorization first. Refer to Grant permissions to a RAM user for refresh and prefetch to complete the authorization.

  • The default header carried in a prefetch request is Accept-Encoding:gzip. To carry other headers in prefetch requests or implement multi-copy prefetch, use the WithHeader request parameter to customize prefetch headers.

  • During prefetch, if the origin server returns a redirection status code such as 307, the prefetch node does not follow the redirect URL to complete the prefetch, which causes the prefetch to fail. If the origin server returns a 301 or 302 status code and 302 redirection is enabled on CDN, normal prefetch is not affected.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cdn:PushObjectCache

none

*Domain

acs:cdn:*:{#accountId}:domain/{#DomainName}

None None

Request parameters

Parameter

Type

Required

Description

Example

ObjectPath

string

Yes

The URL to prefetch. The format is accelerated domain name/file to prefetch.

Note

Separate multiple URLs with line breaks. Each URL can be up to 1,024 characters in length.

example.com/image/1.png\nexample.org/image/2.png

Area

string

No

The prefetch region. Valid values:

  • domestic: the Chinese mainland only.

  • overseas: global (excluding the Chinese mainland).

If you do not set this parameter, the default prefetch region is the CDN acceleration region configured for your domain name.

Note
  • To set the prefetch region to global, make sure that the acceleration region of the accelerated domain name is set to global, and then leave this parameter empty.

domestic

L2Preload

boolean

No

Specifies whether to prefetch content directly to L2 nodes. Valid values:

  • true: The prefetch node levels must include L2 nodes.

  • false: Only back-to-origin layer nodes are prefetched. This is the default value. Back-to-origin layer nodes can be L2 or L3 nodes.

true

WithHeader

string

No

The default header carried in a prefetch request is Accept-Encoding:gzip. To carry other headers in prefetch requests or implement multi-copy prefetch, use this parameter to customize prefetch headers. Submit the value in JSON format.

Note

To exclude the Accept-Encoding header during prefetch, submit the following:

  • {"Accept-Encoding": [" "]}.

{ "Accept-Encoding": [ "gzip, deflate, br" ] }

QueryHashkey

boolean

No

Specifies whether to enable hashkey query mode when executing prefetch tasks. Valid values:

  • false: default mode. This mode is used when the parameter is not specified. The submitted URL is directly used as the hashkey of the prefetched file.

  • true: queries the actual hashkey used by the prefetch URL based on the domain name configuration.

true

ConsistencyHash

boolean

No

If the acceleration region of the domain name is the Chinese mainland and hash-based origin fetch is enabled, you can use this parameter to enable hash-based prefetch. This implements regional back-to-origin convergence and reduces the back-to-origin bandwidth generated by prefetch.

  • true: enables hash-based prefetch.

  • false: default behavior. Hash-based prefetch is not enabled.

Important This parameter takes effect only for domain names whose acceleration region is the Chinese mainland.
.

true

Response elements

Element

Type

Description

Example

object

PushTaskId

string

The ID of the prefetch task. Multiple task IDs are separated by commas (,). The returned task IDs are merged based on the following rules:

  • Prefetch tasks (at URL granularity) submitted for the same domain name within the same second are merged into a single PushTaskId.

  • If more than 500 prefetch tasks (at URL granularity) are submitted for the same domain name within the same second, they are merged into PushTaskId values in batches of 500.

9524xxxx

RequestId

string

The request ID.

16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

Examples

Success response

JSON format

{
  "PushTaskId": "9524xxxx",
  "RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F4CD8"
}

Error codes

HTTP status code

Error code

Error message

Description

400 SingleRequest.OverLimit A maximum of 1000 URLs are supported for each request.
400 QuotaExceeded.Preload Your preload attempts have exceeded the daily limit. The maximum number of URL prefetches on the current day is exceeded.
400 InvalidObjectPath.Malformed The specified ObjectPath is invalid.
400 InvalidExtensiveDomain.ValueNotSupported The specified ExtensiveDomain is not supported.
400 PreloadQueueFull The warming queue is full,please try again later.
400 QuotaPerMinuteExceeded.Refresh You have exceeded the prescribed preload limits per minute.
400 InvalidObjectPath.ExceedsMaximum The maximum number of urls is exceeded. The number of submitted URLs exceeds the maximum limit.
400 InvalidCustomHeader Parse preload header failed. Custom header parsing error.
429 TooManyRequests System load fluctuates, please try again later. System load fluctuates, please try again later.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.