0048-00000100

Updated at:

Problem description

When you use an Object Storage Service (OSS) domain name to access an object from a browser, the browser may download the object instead of displaying it.

Causes

OSS forces a download for certain objects in buckets created after 17:00 on September 23, 2019. This happens when you access an object using an OSS domain name and the object's Content-Type is one of the following:

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

In this case, OSS adds the following two headers to the response:

x-oss-force-download: true
Content-Disposition: attachment

A standard browser starts a download instead of a preview when it receives the Content-Disposition: attachment header.

Example problem

For example, a bucket was created after 17:00 on September 23, 2019. It contains an object named apple.jpeg whose Content-Type is image/jpeg. When you use an OSS domain name to access the object from a browser, the response from OSS includes the two headers mentioned above. The Content-Disposition: attachment header triggers a download instead of a preview in a standard browser.

GET /apple.jpeg HTTP/1.1
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Disposition: attachment
x-oss-force-download: true

Solution

If you do not want OSS to return the headers that force a download, access the object using a custom domain name. For more information, see Map custom domain names.

References