All Products
Search
Document Center

:When you use Alibaba Cloud CDN to accelerate OSS static files, files are forcibly downloaded

Last Updated:May 19, 2022

Issue

After you use Alibaba Cloud CDN to accelerate OSS static files, OSS resources are forcibly downloaded when you access OSS resources.

Cause

The reasons why OSS resources are forcibly downloaded when you use Alibaba Cloud Content Delivery Network to accelerate OSS resources are as follows:

  • The default policy of OSS adds the attachment attribute to the file when accessing the level 3 domain name. As a result, the file is forcibly downloaded.
  • The incorrect Content-Type or Content-Disposition is Alibaba Cloud Content Delivery Network cached.

Solution

To modify the origin host of the Alibaba Cloud Content Delivery Network, configure it as an accelerated domain name instead of a bucket domain name (that is, it is not the domain name at the end of the aliyuncs.com, this domain name is the default domain name of OSS). The procedure is as follows.

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the target domain name and click Manage.
  4. In the left-side navigation pane of the specified domain name, click Back-to-origin Configuration.
  5. Click Modify Configuration next to Back-to-origin HOST.
  6. Turn on the Origin Host switch, set Domain Type to CDN Domain, and click OK.
  7. If the problem is not solved and Alibaba Cloud Content Delivery Network acceleration is enabled for the corresponding resource, the Content-Type of the source resource is set correctly, but the Content-Disposition is not set, indicating that the Alibaba Cloud Content Delivery Network may have cached the wrong Content-Type or Content-Disposition. For more information, see Refresh the cache to update the cache information.
  8. If the problem remains unresolved, see Forced download of resources when accessing resources stored in OSS.

Application scope

  • CDN