Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Intertech Services AG
Yandex Object Storage
  • Getting started
  • Step-by-step guides
  • Tutorials
  • Concepts
    • Overview
    • Bucket
    • Objects
    • Bucket versioning
    • Object lock
    • Encryption
    • Object lifecycles
    • CORS
    • Static website hosting
    • Pre-signed URLs
    • Multipart upload
    • Access control lists (ACLs)
    • Bucket Policy
    • Uploading files via an HTML form
    • Storage class
    • Logging actions with a bucket
    • Backups
    • TLS protocol
    • S3 Select query language
    • Quotas and limits
  • Tools
  • API reference
  • Access management
  • Pricing policy
  • Questions and answers
  1. Concepts
  2. Static website hosting

Static website hosting

Written by
Yandex Cloud

You can host your static website in Object Storage. A static website is one that 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.

Note

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:

http(s)://<bucket_name>.website.yandexcloud.net

or

http(s)://website.yandexcloud.net/<bucket name>

Note

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:

  • Support multiple domain names.

  • Use your own domain.

    To use HTTPS with your own domain, specify the FQDN of the required domain in the bucket name.

Was the article helpful?

Language / Region
Yandex project
© 2023 Intertech Services AG