A resource is the main logical entity in Yandex Cloud CDN that lets you configure and manage content distribution from origins over a CDN.
To start distributing content over a CDN, create a resource and specify in it:
- The origin or origin group that hosts your content.
- The domain names for content distribution.
- The basic settings for HTTP requests to origins.
After creating a resource, you can also configure for it:
- HTTP headers and methods.
- Processing of cross-domain queries (CORS).
- Compression and segmentation of content.
It may take up to 15 minutes for the new resource settings to apply to CDN servers.
Domain names for content distribution
Domain names for content distribution are used in client requests to CDN servers. For example, to make the file
styles/common.css available at
cdn.example.com/styles/common.css, you need to enter
cdn.example.com as a domain name.
When creating a resource, you must enter at least one domain name. The first name you enter is the primary domain name, and you can't change it after you create a resource.
For the resource to run properly, you must have:
Rights to all the domain names you entered.
Access to DNS settings for domain names.
For each name, in the settings of your DNS hosting, you must create a CNAME record linking this name with the domain name of the CDN load balancer, in the format
cl-<random characters>.gcdn.co. It's displayed when creating a resource and also in the management console (on the page of an existing resource). This is a sample record for the
cdn.example.com. CNAME cl-4sne12sd.gcdn.co
Data exchange via HTTP
Clients, CDN servers, and origins exchange data over the HTTP and HTTPS (HTTP over TLS) protocols.
Configuring of data exchange between clients and CDN servers
The communication protocol between clients and CDN servers depends on the URI scheme of your files, for example:
For HTTPS connections between clients and CDN servers, you can:
- Issue TLS certificates from Let's Encrypt® for all domain names for content distribution. Cloud CDN automatically issues certificates after saving the resource settings. This may take up to 30 minutes.
- Use a created certificate or one uploaded to Yandex Certificate Manager.
For a resource, you can configure:
- HTTP headers in CDN server responses to clients.
- CORS processing of cross-domain requests.
- HTTP methods that clients are allowed to use in their CDN requests.
- Sending of compressed content using the
Content-Encoding: gzipHTTP header.
Configuring of data exchange between CDN servers and origins
You can select a protocol for communication between CDN servers and origins: always HTTP, always HTTPS, or the protocol used by the CDN server to communicate with the client.
To enable CDN servers to establish HTTPS connections with origins, you need to configure the domain names of the origins yourself, including issuing TLS certificates for them. For instance, you can use Yandex Certificate Manager: issue a certificate from Let's Encrypt® and get its contents.
For a resource, you can also configure:
- The value of the HTTP
Hostheader for the requests of CDN servers to origins: the primary domain name used for content distribution, echoing the value from the client's request, or some arbitrary value.
- Other HTTP headers in CDN server requests to origins.
- Receiving of files by CDN servers from origins in parts: content segmentation.
Your resource and origins must be configured so that requests from CDN servers are allowed, processed correctly, and not redirected.
For example, if origins redirect requests from a URI with the
httpscheme to a URI with the
httpsscheme, you must select the HTTPS protocol for the resource, and vice versa.
Resource usage statistics
Cloud CDN provides resource usage metrics for the last 30 days:
- Upstream from origins: The volume of traffic streamed by CDN servers from origins.
- Sent: The volume of traffic sent from CDN servers to clients.
- All traffic: The sum of the metrics Upstream from origins and Sent.
- Requests: The number of client requests to the CDN.
- Responses hit: The number of client requests that were responded by CDN servers with cached copies of files without requesting them from origins (if caching is enabled for CDN servers).
- Response miss: The number of client requests that were not responded by CDN servers with cached copies of files (for example, because caching was disabled, the file hasn't been cached by the server yet, or the cache lifetime expired) and CDN servers had to access origins to load files.
- Cache hit ratio: The ratio of traffic sent from CDN servers to clients without accessing origins. It's calculated using the formula
(1 − (Upstream from origins / Sent)) × 100%.
- Responses with 2xx codes, 3xx codes, 4xx codes, 5xx codes: The number of responses with those HTTP status codes sent by CDN servers to clients.