Problem description
When you access an OSS object using a standard domain name, the browser downloads the object instead of displaying it inline.
Causes
This behavior occurs when all three of the following conditions are met:
The bucket was created after 11:00:00 on September 24, 2019.
The object is accessed via a standard domain name.
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
When these conditions are met, OSS adds the following headers to the response:
x-oss-force-download: true
Content-Disposition: attachmentThe Content-Disposition: attachment header instructs the browser to save the response as a file rather than render it inline.
Examples
A bucket created after 11:00:00 on September 24, 2019 contains apple.jpeg with content type image/jpeg. Accessing it via a standard domain name returns the following response:
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 prompt a download instead of rendering the image inline.
Solutions
Use a custom domain name to access the object. For setup instructions, see Map custom domain names.