Static website hosting
To enable hosting, you need public access to the bucket. Otherwise, Object Storage will return the 403 error code to the user trying to access the website.
Object Storage allows you to configure a bucket:
For static website hosting.Upload your website content to the bucket and specify the home page
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <IndexDocument> <Suffix>index.html</Suffix> </IndexDocument> <ErrorDocument> <Key>error.html</Key> </ErrorDocument> </WebsiteConfiguration>
To redirect all requests.You can specify the host to which all requests will be redirected, as well as the protocol for transmitting requests
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <RedirectAllRequestsTo> <HostName>example.com</HostName> <Protocol>http</Protocol> </RedirectAllRequestsTo> </WebsiteConfiguration>
For conditionally redirecting requests.
Using routing rules, you can redirect requests based on the object name prefixes or HTTP response codes. You can redirect an object request to other web pages (if the object was deleted) or redirect the requests that return errors.Example of a rule that redirects a request to a deleted folder to another page
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <RoutingRules> <RoutingRule> <Condition> <KeyPrefixEquals>temp/</KeyPrefixEquals> </Condition> <Redirect> <ReplaceKeyWith>folderdeleted.html</ReplaceKeyWith> </Redirect> </RoutingRule> </RoutingRules> </WebsiteConfiguration>
You can configure static website hosting, redirection for all requests, or conditional request redirection using the Yandex Cloud management console.
All hosting settings are available through Amazon S3-compatible HTTP API.
After you configure the bucket for hosting, the website will become accessible at:
By default, a bucket with a dot in the name is only available over HTTP. To provide HTTPS support for your bucket, upload your own security certificate to Object Storage.
When accessing your website, you will receive responses with the codes described in the Static website response codes section.
When hosting a website, you can:
To use HTTPS with your own domain, specify the FQDN of the required domain in the bucket name.