You can configure static website hosting for a bucket by using the OSS console and access static websites by using the custom domain name bound to the bucket.
- When you use the default custom domain name,
Content-Disposition:'attachment=filename;'is automatically included in the response header. Web page objects are downloaded as attachments. You cannot preview the object content.
- If you use the bound custom domain name,
Content-Disposition:'attachment=filename;'is not included in the response header. You can preview the object content as long as your browser supports previews of web page objects. For more information about how to bind a custom domain name, see Bind custom domain names.
For more information, see Static website hosting.
- Log on to the OSS console.
- Click Buckets, and then click the name of the target bucket.
- In the left-side navigation pane, choose Configure in the Static Pages section. Configure the parameters listed in the following table. . Click
Parameter Description Default Homepage Specify an index page that functions similar to index.html. Only HTML objects can be set to the index page. Static website hosting is disabled if you do not specify this parameter. Default 404 Page Set the default 404 page to display when the requested resource does not exist. Only the HTML, JPG, PNG, BMP, or WebP object in the root folder can be set to the default 404 page. Default 404 Page is disabled if you do not specify this parameter.Note You must ensure that both the index and error documents are readable. Otherwise, the static web page cannot be accessed.
- Click Save.