How Do I Preview Objects in OBS in a Browser Online?
Context
For security and compliance purposes, Huawei Cloud OBS prohibits the preview of objects in a bucket by using the default OBS domain name (a bucket domain name or static website domain name). When you use such a domain name to access objects (such as videos, images, and web pages) in a browser, no content will be displayed. Instead, the content is downloaded as an attachment.
Troubleshooting
Use a user-defined domain name to preview objects.
If you have bound a user-defined domain name to a bucket and enabled CDN acceleration, but the objects are still directly downloaded without object preview, handle the problem by referring to With CDN Acceleration Enabled, Why Are the Objects in My OBS Bucket Directly Downloaded When I Access Them?
Solution: Use a User-Defined Domain Name
Solution advantages and restrictions
- The bucket policy must be public read, so that all objects in the bucket can be accessed by anonymous users.
- Only HTTP requests are supported.
Procedure
- Bind a user-defined domain name to the OBS bucket.
For details, see Configuring a User-Defined Domain Name. During the configuration, add a CNAME record for the OBS bucket domain name.
- Check whether objects can be previewed in a browser online.
Share an object link formatted in http://User-defined domain name/Object access path with other users for them to preview the object.
If the object still cannot be previewed, check whether the value of the object metadata ContentType is supported by the browser.
For example, ContentType should be set to video/mp4 for an MP4 video or set to image/jpeg for a JPG image. For details about all supported ContentType values, see Object Metadata Content-Type.
You can configure ContentType on OBS Console, or using APIs and SDKs.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.