Host header in CDN server requests to origins
To make sure that CDN servers send correct requests to origins, configure the Host
HTTP header value for these requests:
- Primary domain name: First domain name for content distribution specified in the CDN resource settings.
- Custom: Arbitrary domain name.
- Match client: Same value as the
Host
header value in the client request to CDN.
The Host
header value is selected when creating a resource. You can change it afterwards along with other basic resource settings. For more information, see these guides:
How to set up the header properly
Choosing the correct setting for the Host
header depends on the origins you use in your resource:
If the origin is a bucket, select the Custom
option and specify <bucket_name>.storage.yandexcloud.net
as the value. If the bucket is configured for static website hosting, specify <bucket_name>.website.yandexcloud.net
.
In other cases, the setting depends on what requests the origin accepts.
For example, in blue-green and canary deployment scenarios, the L7 load balancer is configured to accept requests with two values of the
Host
header. For the CDN resource, theMatch client
option is selected.
To check that the origin accepts requests with the selected Host
header value correctly, run this command:
curl \
--head \
--insecure \
--header "Host: <header_value>" <address_of_server_or_L7_load_balancer>
If there is one bucket in the group:
- Select the
Custom
option and specify<bucket_name>.storage.yandexcloud.net
as the value. If the bucket is configured for static website hosting, specify<bucket_name>.website.yandexcloud.net
. - Configure other origins (servers and L7 load balancers) so that they accept requests with the specified header value.
If there are multiple buckets in the group, we recommend using the L7 load balancer with buckets that act as backends instead (see the configuration example for blue-green and canary deployment).
In other cases, the setting depends on what requests the origins accept. To check that the origin accepts requests with the selected Host
header value correctly, run this command:
curl \
--head \
--insecure \
--header "Host: <header_value>" <address_of_server_or_L7_load_balancer>