[Yandex Cloud documentation](../../index.md) > [Yandex Cloud CDN](../index.md) > [Concepts](index.md) > Origins and origin groups

# Origins and origin groups

CDN servers retrieve the content requested by clients from _origins_. 

When creating a resource, an origin or an [origin group](#groups) is specified for it. After creating a resource, in the resource settings, you can replace an origin with another origin or a resource group with another resource group.

## Origin type {#types}

As origins, you can use:

* [Bucket](../../storage/concepts/bucket.md) from Yandex Object Storage, for example, configured as a [static site hosting](../../storage/concepts/hosting.md).
* [L7 network load balancer](../../application-load-balancer/concepts/application-load-balancer.md) from Yandex Application Load Balancer. CDN servers will access the load balancer at one of its IP addresses that must be selected in the origin settings.
* Your own server or another resource available by domain name. For example, if the origin is a server with the `files.example.com` domain name, to get the `/static/common.css` file, CDN servers will try access the server at this address: `files.example.com/static/common.css`.


### Use cases {#examples-types}

* [Migrating to Yandex Cloud CDN from a third-party CDN provider](../tutorials/migrate-to-yc-cdn.md)
* [Publishing game updates using Yandex Cloud CDN](../tutorials/prefetch.md)
* [Editing website images using Thumbor](../tutorials/thumbor.md)
* [Enabling a blue-green and canary deployment of web service versions](../tutorials/blue-green-canary-deployment.md)
* [Providing secure access to content in Cloud CDN](../tutorials/protected-access-to-content/index.md)


## Static website hosting in a source bucket {#bucket-website-hosting}

You can publish your static website through Cloud CDN if its files are stored in a bucket in Object Storage. 

To make sure your website is displayed correctly, e.g., so that when entering `https://<domain_name>/`, the website homepage would open rather than the list of objects, configure your bucket in Object Storage and the origin in Cloud CDN as follows:

1. Create your website homepage, e.g., `index.html`, and [upload it](../../storage/operations/objects/upload.md) to the bucket.
1. [Configure static website hosting](../../storage/operations/hosting/setup.md#hosting) in your bucket. In the settings, specify the homepage you uploaded in the previous step.
1. [Configure the origin](#instructions) in the CDN resource or in an origin group by specifying the bucket and enabling its use as your static website hosting. After that, the CDN server will try to access the bucket by the `<bucket_name>.website.yandexcloud.net` domain name.


### Use cases {#examples-bwh}

* [Providing secure access to content in Cloud CDN](../tutorials/protected-access-to-content/index.md)
* [Setting up static website hosting in a Yandex Object Storage bucket with Yandex Cloud CDN access](../tutorials/cdn-hosting/index.md)


## Origin response time {#timeout}

{% note info %}

CDN servers do not support IPv6 and can only access sources at IPv4 addresses.

{% endnote %}

An origin must respond to the CDN server's request within 5 seconds. If no response is received during this time, the CDN server will respond to the client with the `504 Gateway Timeout` HTTP status code.

To reduce both the load of CDN servers on origins and the response time, you can enable [origin shielding](origins-shielding.md) for a resource.


## Origin groups {#groups}

To distribute the load between origins hosting the same content, you can combine them into an origin _group_.

Origins in the group can be active or backup. Requests from CDN servers are distributed among active origins in a circular manner.

> For example, if an origin group includes two active origins, the first content request will be sent to the first origin, the second request ‒ to the second origin, the third request ‒ to the first origin again, and so on.

If the active origin responded to the CDN server with HTTP status code 5xx, the request is sent to one of the backup origins. If there are no backup origins in the origin group or the response includes code 5xx again, the CDN server sends the response with code 5xx to the client.

{% note tip %}

If you publish content in two or more buckets, combine them into a group of L7 load balancer backends and use the load balancer as an origin as shown in the [blue-green and canary deployment](../tutorials/blue-green-canary-deployment.md) scenario. Otherwise, you will need to make sure the service supports sending requests to the CDN with different [`Host` header](servers-to-origins-host.md) values mapped to different buckets.

{% endnote %}


### Use cases {#examples-g}

* [Editing website images using Thumbor](../tutorials/thumbor.md)
* [Enabling a blue-green and canary deployment of web service versions](../tutorials/blue-green-canary-deployment.md)
* [Integrating an L7 load balancer with Cloud CDN and Object Storage](../tutorials/cdn-storage-integration/index.md)
* [Providing secure access to content in Cloud CDN through Terraform](../tutorials/protected-access-to-content/terraform.md)


## How to configure origins {#instructions}

For details, see these guides:

* Configuring an origin or origin group while [creating a resource](../operations/resources/create-resource.md).
* [Editing the basic settings of a resource](../operations/resources/configure-basics.md), including changing an origin or origin group to a different one.
* [Managing origin groups](../operations/index.md#origin-groups): creating, updating, connecting them to a resource, and deleting them.


### Use cases {#examples-ins}

* [Integrating an L7 load balancer with Cloud CDN and Object Storage](../tutorials/cdn-storage-integration/index.md)