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 PoPs still store stale versions of your content
- Whether the origin server stores different versions of files
- Whether the content is hijacked
Procedure
- Check cache rules.
- Cache rules may be incorrect.
- For dynamic files (such as PHP, JSP, and ASP files), set the cache 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.
- 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.
- For more cache settings, see Setting the Cache TTL.
- Cache rules may be incorrect.
- 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.
- 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 purge the cache manually.
- Log in to Huawei Cloud console. Choose . In the navigation pane, choose Prefetch & Purge. On the Purge tab, purge the cache.
- Call the cache purge or prefetch API to purge the cache. For details, see API Reference.
- 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 and standby servers are different.
If the fault is caused by either of the preceding reasons, store the same version of files on your servers.
- Check whether the content is hijacked.
If the content 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot