All Products
Search
Document Center

The files downloaded using the CDN service are inconsistent.

Last Updated: Apr 03, 2020

Problem Description

After you use the CDN service to download an object, the object content may be inconsistent.

 

Cause of problem

When you access resources on the CDN node by using the CDN service, the cache will be sent back to you if it has not expired. During this period, if the origin server has updated resources by using the same name, after you access these resources, the server detects that the requested resources are legacy resources. As a result, the content on your website is inconsistent.

Note: When you update the directory with the same name, the object content is modified, but the object name is not changed.

 

Solution

We recommend that you perform the following operations to resolve the inconsistency between the files downloaded by using the CDN service.

  • The origin site does not update the operation with the same name or add a version number.
    • CDN does not perceive an update by using the same name on the origin server. Therefore, we recommend that you update files with the same name on the origin server.
    • By adding the version parameter to the URL, when CDN requests new resources, the CDN retrieves the data from the source.
      Note: With this method, you cannot enable this feature in the CDN console. Otherwise, the request becomes invalid.
  • When you update the file with the same name on the origin server, you can use the console or API to manually refresh the corresponding URLs. In this way, the content on the origin server is consistent with the content cached on CDN. The refresh mode can be divided into Directory refresh and URL refresh. For more information about how to configure refresh, see how do I update files after configuring CDN?. URL refresh is suitable for a single resource. The refresh speed is fast. Directory refresh refreshes all files in the directory, so the refresh speed is slow. The next request for all resources in the directory can reroute to the origin server. Therefore, the bandwidth of the origin server may be affected.
    • URL refresh: the files on the CDN CACHE node are forcibly set to expired. In this case, CDN performs back-to-origin operations for updates. The refresh period is about 5 to 10 minutes. The URL can be refreshed to a maximum of 2,000 times per day with the same ID.

      Note: The entered URL must contain http://.

    • Directory refresh: the files in a directory on the CDN CACHE node are forcibly set to expired. The refresh takes effect within 30 minutes. You can submit a maximum of 100 refresh requests a day.
      Note: The input content must start with http:// start with /end. You must use the directory refresh tab to refresh the directory. Otherwise, the system refreshes a single URL on the URL refresh tab.
  • If the CDN origin is OSS, you can enable CDN cache refresh in the OSS console. When an Object is updated on the OSS origin with the same name, the CDN refresh interface is called to refresh the corresponding URL. You can enable the auto CDN cache update function in the following steps.
    1. Login OSS console.
    2. In the left-side bucket list, click the name of the target bucket.
    3. Click domain name management tab.
    4. On the record where you have bound the domain name, you can see  auto CDN cache update the switch, open.

 

Applicable to

  • CDN