All Products
Search
Document Center

CORS configurations of OSS fail due to CDN acceleration

Last Updated: Apr 03, 2020

Problem Description

When CDN acceleration is configured for the Bucket of the OSS or the image service function is enabled, the CORS configuration on the OSS may fail.

 

Cause of problem

CDN implements acceleration by caching files on nodes and directly returning the files to clients from the nodes. However, even if a file is changed on the origin, users will still be able to access the file previously cached on the node rather than the file after the update, unless a cache refresh operation is performed on the CDN.

 

After CDN acceleration or the image processing feature is enabled, all files already accessed are cached on the CDN node. If CORS settings are configured or changed, CDN cached content is not automatically synchronized with the configuration update, causing CORS to not take effect.

 

Solution

After you modify the CORS settings, we recommend that you refresh the cache for the relevant URLs in the CDN console for the CORS settings to take effect.

Note: For the cache refresh API, see refresh the cache.

  1. Log on to the CDN console.
  2. Select refresh and prefetch > refresh the cache to fill in the URL that you want to refresh, click refresh.
  3. Check whether the HTTP header parameters are correctly configured. For more information, see configure Cross-Origin Resource Sharing (CORS) for CDN and precautions.

 

Applicable to

  • CDN