marcuslow
Intern
Intern
  • UID8704
  • Fans0
  • Follows0
  • Posts5
Reads:2439Replies:5

Static page hosting on oss

Created#
More Posted time:Jan 30, 2020 17:51 PM
hi all,


i am trying out the static page hosting on oss but to my surprise it does not load the index.html static page at all.


Steps takem:
1. Create oss bucket set Basic Setting -> ACL  = Public Read
2. Set Static Pages -> Default Homepage = index.html
3. Set Static Pages -> Default 404 Page = error.html
4. Upload index.html & error.html into the bucket
5. Access the bucket via https://bucket-name.oss-region.aliyuncs.com/ will download the index.html page instead of displaying the content.
6. Access the non-existing page will show the error.html


May i know what else am i missing in the above steps.


Sundaram
Intern
Intern
  • UID8706
  • Fans0
  • Follows0
  • Posts1
1st Reply#
Posted time:Jan 30, 2020 20:04 PM
Hi Marcuslow,
The above steps seems correct.
But From August 13th, 2018 onwards, when you use an OSS endpoint to access a web file through the Internet, the Content-Disposition: 'attachment=filename;' is automatically added to the Response Header, and hence the web file is downloaded as an attachment.


If you access OSS with a user customer domain, the Content-Disposition: 'attachment=filename;' will not be added to the Response Header. For more information about using the user domain to access OSS, see Bind Custom Domain Names.

Refer to the link below.https://www.alibabacloud.com/notice/oss0813

Thanks.

Regards,
Sundaram

kcloud
Engineer
Engineer
  • UID7778
  • Fans0
  • Follows0
  • Posts52
2nd Reply#
Posted time:Jan 30, 2020 20:45 PM
Hi,

Binding custom domain name will make it work.

Check out the tutorial: Host a static website using a custom domain name
https://www.alibabacloud.com/help/doc-detail/67323.htm

Also, refer: Host a Static Website on OSS
https://www.alibabacloud.com/getting-started/projects/host-a-static-website-on-oss

Cheers,
K

marcuslow
Intern
Intern
  • UID8704
  • Fans0
  • Follows0
  • Posts5
3rd Reply#
Posted time:Jan 31, 2020 10:47 AM
Tks Sundaram and kcloud, will give it a try

kcloud
Engineer
Engineer
  • UID7778
  • Fans0
  • Follows0
  • Posts52
4Floor#
Posted time:Feb 1, 2020 10:50 AM
Most welcome, let us know how it goes...

Rayray
Intern
Intern
  • UID8414
  • Fans0
  • Follows0
  • Posts23
5Floor#
Posted time:Apr 4, 2022 10:52 AM
Just 1 more step you need




Map the custom domain name to the bucket

Map the registered custom domain name example.com to the examplebucket bucket that you create to use the domain name to access the bucket.
  1. On the Overview page of the bucket to which you want to map the custom domain name, choose Transmission[p] > [/p]Domain Names in the left-side navigation pane.
  2. Click Bind Custom Domain Name.
  3. Enter example.com in the Custom Domain Name field and turn on Add CNAME Record Automatically.
  4. Click OK.

cheers,ray
Guest