Problem description
When you use a standard domain name to access an image object in OSS from a browser, the browser downloads the object instead of displaying it.
Causes
This behavior affects buckets created after 17:00:00 on September 23, 2019, when 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/heicFor requests that meet these conditions, OSS automatically adds the following response headers:
x-oss-force-download: true
Content-Disposition: attachmentThe Content-Disposition: attachment header tells the browser to download the file instead of rendering it.
Examples
A bucket created after 17:00:00 on September 23, 2019, contains an object named apple.jpeg with content type image/jpeg. When you use a standard domain name to access this object from a browser, OSS 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 download the file.
Solutions
Use a custom domain name to access the object. When accessed through a custom domain name, OSS does not add the x-oss-force-download or Content-Disposition: attachment headers, so the browser displays the image directly.
To bind a custom domain name to your bucket, see Map custom domain names.