Help Center> Content Delivery Network> Troubleshooting> Why Is the Displayed or Downloaded Content Incorrect After CDN Acceleration Is Used?
Updated on 2023-06-26 GMT+08:00

Why Is the Displayed or Downloaded Content Incorrect After CDN Acceleration Is Used?

Symptom

After CDN acceleration is enabled, when a user accesses a website or app, the displayed or downloaded content is incorrect.

Check Items

  • Cache rules
  • Local cache
  • Whether CDN points of presence (PoPs) still store stale versions of your content
  • Whether the origin server stores different versions of files
  • Whether content access is hijacked

Procedure

  1. Check cache rules.
    1. Cache rules may be incorrect.
      • For dynamic files (such as PHP, JSP, and ASP files), set the cache time to live (TTL) to 0, so these files are not cached and are pulled from the origin server for each request.
      • For static files (such as JPG and ZIP files) that are not frequently updated, set the cache TTL to more than one month.
      • For static files (such as JS and CSS files) that are frequently updated, set the cache TTL based on service requirements.
    2. The cache rule priority may be incorrect. As a result, the cache rules do not take effect. The priority value ranges from 1 to 100. The larger the value, the higher the priority.

      Assume that you have set a rule with the cache TTL as two days for JPG files.

      As shown in the preceding figure, the first rule indicates that the cache TTL of all files is 30 days, and its priority is 8. The second rule indicates the cache TTL of JPG files is 2 days, and its priority is 2. When a user requests a JPG file, the first rule is matched because its priority is higher. Therefore, the JPG file will be cached on CDN PoPs for 30 days instead of 2 days.

    3. For more cache settings, see Setting the Maximum Cache Age.
  2. Check whether the fault is caused by the local cache.

    Clear the browser cache and request content again to check whether the fault has been solved.

  3. Check whether CDN PoPs still store stale versions of your content.
    If the content on the origin server is updated, but the cache on CDN PoPs is not refreshed and is still valid, the cache will be returned to users. You can manually refresh the cache in either of the following ways:
    1. Log in to the Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network. In the navigation pane, choose Prefetch & Purge. On the Purge tab, refresh the cache.
    2. Call the cache purge or prefetch API to refresh the cache. For details, see API Reference.
  4. Check whether the origin server stores different versions of files.
    • Your origin server uses load balancing. There are multiple servers at the backend, and they store different versions of files.
    • A standby origin server is added on the CDN console, but files stored on the primary server and the standby server are different.

    If the fault is caused by either of the preceding reasons, store the same version of files on your origin servers.

  5. Check whether content access is hijacked.

    If content access is hijacked, configure HTTPS to enhance security. Common hijacks are as follows:

    • When you visit a website, 302 is returned, but the address specified by location in the response is not the desired one. Enter the URL to be accessed in the address bar of Google Chrome, press F12, click the Network tab, and click a resource. On the displayed Headers tab, find location under Response Headers to check its value.
    • When you visit a website, the content displayed is not the desired content.

If the fault persists even after taking the previous steps, submit a service ticket.