Problem description
When you use a standard domain name of Object Storage Service (OSS) to access an object from a browser, the browser downloads the object instead of displaying it.
Causes
OSS standard domain names follow storage API conventions and are not optimized for browser access. When you use a standard domain name to access a bucket created after 17:00:00 on September 24, 2019, and the object's content type is one of the following values, OSS adds the x-oss-force-download and Content-Disposition headers to the response:
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/heicThe Content-Disposition: attachment header tells the browser to download the file rather than render it inline.
Examples
The following example shows a request for apple.jpeg (content type: image/jpeg) in a bucket created after 17:00:00 on September 24, 2019, using a standard domain name:
GET /apple.jpeg HTTP/1.1
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Disposition: attachment
x-oss-force-download: trueThe Content-Disposition: attachment header causes the browser to download the object instead of displaying it.
Solutions
To display the object inline in a browser, use a custom domain name to access the object. Requests through a custom domain name do not include the x-oss-force-download and Content-Disposition headers, so browsers render the object inline. For setup instructions, see Map custom domain names.