Problem description
When a standard domain name of Object Storage Service (OSS) is used to access an object from a browser, the browser downloads the object instead of providing a preview of the object.
Causes
If you use a standard domain name to access a bucket that was created after 11:00:00 on September 24, 2019, to request an object whose content type is one of the following values, the response returned by OSS includes the x-oss-force-download and Content-Disposition headers:
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
Sample response headers:
x-oss-force-download: true
Content-Disposition: attachment
Content-Disposition: attachment
triggers a download operation instead of a preview in a standard browser.
Examples
For example, a bucket that was created after 11:00:00 on September 24, 2019, contains an object whose name is apple.jpeg and whose content type is image/jpeg
. When you use a standard domain name to access the object from a browser, the response returned from OSS includes the preceding two headers. Content-Disposition: attachment
triggers a download operation 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
Solutions
If you do not want OSS to return a header that triggers the download operation, use a custom domain name to access the object. For more information, see Map custom domain names.