0048-00000102

Updated at:

Problem description

When you access an object in a browser using a standard Object Storage Service (OSS) domain name, the object may be downloaded directly instead of being previewed.

Causes

For buckets created after 17:00 on September 24, 2019, when you use an OSS domain name to access a file whose 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

OSS adds the following two headers to the response:

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

In a standard browser, the Content-Disposition: attachment header prompts the browser to download the object instead of previewing it.

Example Problems

For example, a bucket was created after 17:00 on September 24, 2019. It contains an object named apple.jpeg, and its Content-Type is image/jpeg. When you access this object from a browser using a standard OSS domain name, OSS adds two headers to the response. The Content-Disposition: attachment header prompts the browser to download the object instead of previewing it.

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

Solution

To prevent OSS from returning headers that force a download, access the object using a custom domain name. For more information, see Map custom domain names.