Hi @ Abdul Basit,
Welcome to Microsoft Q&A Platform
I can see that you're dealing with some frustrating cache issues with your Azure CDN and the outdated travel guides not reflecting the new content. Here are some steps and considerations that might help you resolve this:
- Purge the Cache Again: It seems you’ve tried standard purging, but sometimes it’s beneficial to use more aggressive options. You can try the following:
- Purge Specific Files: Navigate to your CDN endpoint in the Azure portal and select the Purge button. Enter the path of the files you want to purge.
- Use Wildcards: Consider using wildcards in your purge request (e.g.,
/path/to/update/*). - Purge All: If specific purging doesn’t work, try selecting Purge All to clear the entire CDN cache. This can ensure all stale files are removed.
- Double-Check Cache-Control Headers: Make sure that your cache-control headers are set correctly in your origin server. Using shorter expiration times, such as a few minutes, can help, but ensure the origin files are accessible without caching for immediate updates. For example:
- Use
Cache-Control: no-cacheon important files that need immediate updates.
- Use
- Verify Origin Content: Confirm that the new content is being served correctly from your origin server. Use a request similar to
https://your-origin-url/path/to/your/fileto check that you're getting the updated content directly from the origin. - Monitor for Propagation Delay: Sometimes purging might take longer than expected. If you’ve purged your files, wait for about 15-30 minutes before checking the CDN again, as changes can take time to propagate across all edge nodes.
- Inspect Caching Behavior: Use the browser's developer tools (F12) to inspect the response headers and see if the CDN is hitting the cache. Look for the
x-cacheheader; if it indicates a cache hit, your browser may be serving the old file from its cache rather than the CDN. - Consider Versioning the Content: If the above methods are still causing issues, you might consider appending version numbers or cache-busting query strings to your asset requests. For instance, change
file.jstofile.js?v=2.
If you continue to encounter delays or issues, here are some follow-up questions that could help diagnose further:
- What specific content types (HTML, images, etc.) are you experiencing issues with?
- Have you noticed any patterns in the cache update delays, such as specific times when this tends to happen more often?
- Can you confirm if the cache-control settings on your origin server are correctly configured to allow for quick refreshes?
- Have you checked the response headers for any pertinent caching directives that might affect the CDN behavior?
I hope this helps you get your CDN caching under control! If you have more questions or run into other issues, feel free to reach out again.
References:
- Purge an Azure Content Delivery Network endpoint
- Control Azure Content Delivery Network caching behavior with query strings
- CDN Best Practices
- How to Manage Expiration of Blob Content in the Azure Content Delivery Network
If you have any questions, please leave a comment below, I will respond to you.
Please do not forget to
and “up-vote” wherever the information provided helps you, this can be beneficial to other community members**.**