Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud CDN
    • Overview
    • Points of presence
    • Resource
    • Configuring Cloud CDN when the origin is unavailable
    • Origins and origin groups
    • Request redirection
    • Content caching
    • Secure tokens
    • IP-based access policy
    • Country-based access policy
    • Dedicated IP addressing
    • Location rules
    • Log export
    • Labels
    • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Request logs
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • How Yandex Cloud CDN handles origin unavailability
  • Enable caching on the resource
  • Enable origin shielding
  • Prepare a standby origin
  • Add the second origin to the origin group
  • Allow delivery of outdated content, if applicable
  • Complete the setup before an outage occurs
  • Test the standby origin
  1. Concepts
  2. Configuring Cloud CDN when the origin is unavailable

Configuring Yandex Cloud CDN when the origin is unavailable

Written by
Yandex Cloud
Updated at November 13, 2026
View in Markdown
  • How Yandex Cloud CDN handles origin unavailability
  • Enable caching on the resource
  • Enable origin shielding
  • Prepare a standby origin
  • Add the second origin to the origin group
  • Allow delivery of outdated content, if applicable
  • Complete the setup before an outage occurs
  • Test the standby origin

To ensure your CDN resource continues delivering content when the primary origin is unavailable, enable caching, configure origin shielding, and connect a standby origin in advance. If your application supports older file versions, you can also allow serving stale content from the cache.

How Yandex Cloud CDN handles origin unavailabilityHow Yandex Cloud CDN handles origin unavailability

CDN servers located at various points of presence deliver content directly to users. An outage at the origin data center does not automatically stop content delivery through the CDN.

If your CDN resource only has one origin that becomes unavailable, the outcome depends on the current state of the cache:

File state

Expected behavior

The file exists in the CDN server cache, and the cache TTL has not expired.

Cloud CDN continues to deliver the file.

The file is not in the cache.

Cloud CDN must retrieve the file from the origin, or from the shielding server if origin shielding is enabled.

The cache TTL has expired.

Cloud CDN must refresh the file from the origin.

The cache TTL has expired, and delivery of outdated content is enabled.

If the stale conditions are met, Cloud CDN delivers the cached copy.

File caching is disabled.

To get the file, each user request requires an available origin.

If there is a cache miss and the origin is unavailable, the user will get an error. In case of a timeout, this may be 504 Gateway Timeout. On other failures, the error code may vary.

Note

Each point of presence has its separate cache. A file cached on one CDN server may not exist at other points of presence. For details, see Content caching.

To improve resource fault tolerance:

  1. Enable caching on the resource.
  2. Enable origin shielding.
  3. Prepare a standby origin.
  4. Add the second origin to the origin group.
  5. Allow delivery of outdated content, if applicable.
  6. Complete the setup before an outage occurs.
  7. Test the standby origin.

Enable caching on the resourceEnable caching on the resource

  1. In the management console, select the folder where your resource is located and navigate to Cloud CDN.
  2. Click the resource name.
  3. Navigate to the Caching tab and click Edit.
  4. Under CDN, enable CDN caching.
  5. Select the setting type: Same as origin or Custom settings. Set the cache lifetime.
  6. Click Save.

For a step-by-step guide, see Configuring caching.

Tip

Make sure your files are cached correctly. Check the Cache-Status response header returned by Cloud CDN: the HIT value indicates the file was delivered from the cache.

Caching behavior depends on the resource settings and origin response headers. Browser caching is configured separately and does not replace CDN server caching.

If caching is disabled or a file is excluded from caching, Cloud CDN will access the origin each time the file is requested. Set your cache TTL based on how frequently your content updates.

Enable origin shieldingEnable origin shielding

Origin shielding adds an intermediate caching layer between the CDN servers and origins. If a file is not in the CDN server's cache, the request goes to the shielding server first. If a valid cached copy exists there, no requests are sent to the origin.

The shielding server also consolidates duplicate requests for a single file. This reduces redundant content downloads from the origin and lowers its load.

Origin shielding can significantly improve caching efficiency, especially when users request the same files through different points of presence. The result depends on request patterns and cache settings. For details, see Origin shielding.

To enable shielding:

  1. Open the resource in Cloud CDN.
  2. Navigate to the Origin shielding tab.
  3. Click Activate, select an available location, and confirm.
  4. Make sure the status has changed to Active.

It may take up to 15 minutes to apply the settings.

Warning

Origin shielding is billed separately. A full monthly fee is charged on the day the feature is enabled.

Learn more in this guide on enabling shielding.

Use origin shielding in addition to origin redundancy. If a file is missing from both the CDN server cache and the shielding server, the CDN must fetch it from an available origin.

Prepare a standby originPrepare a standby origin

To retrieve files when the primary origin is down, you need a secondary origin containing a copy of your content.

For VMs, you can use a different availability zone. To protect against a full cloud platform outage, host your standby origin in another cloud or independent infrastructure.

Note

A duplicate Object Storage bucket cannot serve as an independent backup for service-wide outages.

Before adding a standby origin, confirm the following:

  • The files are accessible at the same paths as on the primary origin.
  • All file copies are up-to-date.
  • The origin is accessible to Cloud CDN, considering network restrictions and access permissions. Use an up-to-date list of Cloud CDN networks. If origin shielding is enabled, contact support to get the list of the shielding servers’ networks.
  • Protocol configurations and the setting of HTTPS TLS certificates and Host headers are compatible with both origins.
  • The standby origin can handle the load if the primary origin fails.

Tip

When using different buckets, make sure to check the Host header. A value supported by one of the buckets may be incompatible with the other. For details on how to implement this setup, see the Host header section.

Add the second origin to the origin groupAdd the second origin to the origin group

In the management console, go to the Cloud CDN page and open the Origin groups tab. Create a new group or update an existing one. Add both origins, enable them, and set their priorities.

The following options are available:

Priorities

Behavior

Primary and primary

Requests are distributed using the round-robin method. Both origins handle requests.

Primary and standby

Cloud CDN sends a request to the primary origin first. If a retryable error occurs, the request fails over to the standby origin.

In round-robin mode, individual requests are balanced across the origins. A single file is never fetched from two origins at the same time. For more information, see Origins and origin groups.

Note

Failover takes place only during connection errors, timeouts, and responses with HTTP codes 500, 502, 503, and 504. Responses with 403 and 404 codes do not trigger a failover. For example, if a file is missing from the primary origin, Cloud CDN will not automatically look for it on the backup origin.

Once configured, add the group to the CDN resource.

It may take up to 15 minutes for settings to apply to the CDN servers. Wait for them to propagate, then test the standby origin. During failover, response times may increase while waiting for the primary origin to time out.

Allow delivery of outdated content, if applicableAllow delivery of outdated content, if applicable

For some types of content, delivering an outdated file version is often better than returning an error. In this scenario, you can allow Cloud CDN to deliver a cached copy after its TTL expires if the origin is unavailable.

When using the API, you can configure this behavior through the options.stale CDN resource parameter. Here is a configuration snippet example:

{
  "options": {
    "stale": {
      "enabled": true,
      "value": [
        "error",
        "timeout",
        "http_500",
        "http_502",
        "http_503",
        "http_504"
      ]
    }
  }
}

This example allows the CDN to deliver stale content during network errors, timeouts, and the specified HTTP status codes.

For a new resource, use the create REST API method for the Resource resource or the ResourceService/Create gRPC API call. For existing resources, use the update REST API method for the Resource resource or the ResourceService/Update gRPC API call.

Example of modifying a CDN resource using curl
export IAM_TOKEN=$(yc iam create-token)
curl \
  --request PATCH \
  --header "Authorization: Bearer $IAM_TOKEN" \
  --header "Content-Type: application/json" \
  --url 'https://cdn.api.cloud.yandex.net/cdn/v1/resources/<resource_ID>' \
  --data '{
    "options": {
      "stale": {
        "enabled": true,
        "value": [
          "error",
          "timeout",
          "http_500",
          "http_502",
          "http_503",
          "http_504"
        ]
      }
    }
  }'

For information on the IAM token and CDN resource ID, see the following pages:

  • Getting resource info
  • API authentication

Note

Delivery of outdated content is only possible if a cached copy exists. If the file was never cached or has been removed, an available origin is required.

The conditions for outdated content delivery and origin failover are configured independently. Adding an error code to stale does not automatically enable origin failover for that code.

Complete the setup before an outage occursComplete the setup before an outage occurs

During an outage, management operations for Cloud CDN may be unavailable along with your origins. This includes viewing resources, updating configurations, cache purging or pre-fetching.

Add your standby origin in advance and wait for the settings to apply. This enables Cloud CDN to automatically route traffic to the standby origin if the primary one goes down. You will not need to modify settings If the management console or API become unavailable.

Warning

Do not purge the cache when origins are unavailable unless absolutely necessary. Purging deletes all cached copies, and Cloud CDN may be unable to retrieve them again.

Test the standby originTest the standby origin

For testing, use a separate, dedicated test CDN resource. You can create it by copying the configuration of your production resource. Copying is restricted to a folder. Make sure this new test resource has its own domain name and a CNAME record.

  1. Place identical test files on both the primary and standby origins.
  2. In the test resource, set the production standby origin as its sole primary origin. Use a separate origin group to avoid modifying your production resource group.
  3. Wait for the settings to apply.
  4. Send the exact same request through the test CDN resource as you would through production: use the same file path, query parameters, HTTP method, and required headers. Change only the CDN resource domain name to the test domain. Before testing, make sure the response is not fetched from a pre-populated cache of the test resource or shielding server.
  5. Compare the HTTP status code, content, and key response headers with those of the production resource.
  6. Check the standby origin logs to confirm request delivery.

This test confirms the backup origin is accessible to Cloud CDN and delivers content correctly.

To further test automatic failover, create a separate group with two test origins of the primary and standby priorities. Connect this group to your test CDN resource and wait for the settings to apply. Simulate a failover error, e.g., a 503 response, on the primary test origin. Request a file that is yet uncached by both the CDN and shielding servers. Check your standby origin’s logs to confirm it received the request. Restore the primary origin after testing.

Useful linksUseful links

  • Recommendations on fault tolerance in Yandex Cloud
  • Yandex Cloud CDN overview

Was the article helpful?

Previous
Resource
Next
Origins and origin groups
© 2026 Direct Cursus Technology L.L.C.