All Products
Document Center

Resources are forcibly downloaded after accessing OSS resources

Last Updated: Sep 26, 2021

Problem description

Use a browser to access OSS resources. OSS resources are forcibly downloaded.


The possible reasons for the forced download of the file are shown below:

  • The default domain name provided by OSS is used and no other configurations are validated.
  • The error message returned because the Content-Type of the corresponding resource is incorrectly set.
  • The Content-Disposition of the corresponding resource is set incorrectly.
  • The incorrect Content-Type or Content-Disposition is Alibaba Cloud Content Delivery Network cached.
  • The browser does not support the display of resources in this format.


For security reasons, starting from September 23, 2019, the default domain name provided by OSS is directly used for the newly created buckets. When you access the image type files of the buckets on OSS from the Internet, mimetype is the following value, and the Content-Disposition:'attachment=filename;' is automatically added to the Response Header. That is, when you access an image-type file from a browser, it is downloaded as an attachment. We recommend that you use a custom domain name to access OSS requests. For more information about how to bind a custom domain name, see Bind a custom domain name. By default, no download is forced. For more information.

Note: Buckets created before 0:00 on September 23, 2019 are not covered.

image/jpeg, image/gif, image/tiff, image/png, image/webp, image/svg + xml, image/bmp, image/x-ms-bmp, image/x-cmu-raster, image/exr, image/x-icon, image/heic

This issue occurs with extensions in the following formats.

jpg, jpeg, jpe, png, tif, tiff, gif, svg, bmp, ico, ras, dib, svgz, webp, bm, jfif, x-png, exr, and heic

If the user uses a custom domain name or a forced download problem occurs, you can refer to the following steps to resolve the problem.

  1. Log on to the OSS console, click the target bucket, and then click Files. Find the target resource and click More > Set HTTP Header in the Actions column.
  2. Then, set the exact Content-Type parameter, cancel the Content-Disposition parameter, and then click OK. For more information about how to set HTTP headers, see Set HTTP headers.
  3. 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.
  4. If the problem is still unresolved, it is determined that the browser does not support the display of the corresponding format resources. For Web applications, we recommend that you add corresponding controls to display resources in the corresponding format.


For more information about static website hosting, see Configure static website hosting.

Application scope

  • OSS