Hosting static websites
You can host your static website in Object Storage. A static website is based on such client-side technologies as HTML, CSS, or JavaScript. It may not contain any scripts that run on the web server side.
In a static website, pages are objects in a bucket, where object keys match the website page paths, and the full URL of a page has http(s)://website.yandexcloud.net/<bucket_name>/<object_key>
format.
Note
To enable hosting, you need public access to the bucket. Otherwise, Object Storage will return the 403 error code if you try 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>
-
For redirecting 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 conditional redirects.
Using routing rules, you can redirect requests based on the object name prefixes or HTTP response codes. This enables you to redirect object requests to different web pages (if the object was removed) 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 the Amazon S3-compatible HTTP API.
After you configure the bucket for hosting, the website will become accessible at:
http(s)://<bucket_name>.website.yandexcloud.net
Or:
http(s)://website.yandexcloud.net/<bucket_name>
Note
If you use such URLs as http(s)://<bucket_name>.storage.yandexcloud.net
, the HTTPS protocol is available for the bucket only if the bucket name does not contain dots, e.g.:
https://example.storage.yandexcloud.net
: HTTPS is available for this bucket.http://example.ru.storage.yandexcloud.net
: HTTPS is not available for this bucket.
This is because Object Storage uses Wildcard certificates
To provide HTTPS support for a bucket with a dot in the name, upload your own security certificate to Object Storage.
Request redirects from HTTP to HTTPS are enabled automatically once you set up HTTPS access to a bucket. No other settings are required.
Alert
Starting July 1, 2025, Object Storage will discontinue support for the TLS protocol versions 1.0 and 1.1.
For more information, see TLS protocol.
When accessing your website, you will get responses with the codes described in Static website response codes.
When hosting a website, you can:
-
To use HTTPS with your own domain, specify the FQDN of the required domain in the bucket name.
You can manage Yandex Cloud DNS domains in the bucket settings or in Cloud DNS.
You can get files from a publicly available bucket using a public link via both HTTP and HTTPS even if no website hosting is configured for the bucket. In this case, a cloud-level certificate from GlobalSign