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
    • Cloud Desktop
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • 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
    • Origins and origin groups
    • Request redirect
    • Content caching
    • Secure tokens
    • IP-based access policy
    • Dedicated IP addressing
    • Location rules
    • Log export
    • Labels
    • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Metrics Monitoring
  • Request logs
  • Audit Trails events
  • Release notes
  • Troubleshooting
  1. Concepts
  2. Location rules

Location rules Yandex Cloud CDN

Written by
Yandex Cloud
Updated at July 9, 2026
View in Markdown

Location rules are a mechanism used to selectively redefine CDN resource settings for requests whose paths match a specific template.

Let’s assume that content caching is enabled in the CDN resource settings, while cache lifetime is set to four days. This is enough for most types of content, but for some specific files you have to reduce cache lifetime to a few seconds. Location rules will help you with such cases.

You can use location rules to override the following CDN resource settings:

  • Origin group
  • Content caching
  • Request redirect
  • Parameters of access via secure tokens
  • IP-based access policy
  • HTTP request and response headers
  • Allowed HTTP methods for client requests
  • Cross-domain CORS requests
  • Content compression
  • Content segmentation
  • Non-standard HTTP responses

Note

The settings of HTTP headers and methods, CORS, content compression and segmentation, as well as advanced content caching options, become available after you create a location rule. For more information, see Configuring advanced settings.

For each location rule, specify the following parameters:

  • Regular expression: URI path pattern against which requests are checked. If there is a match, the settings specific to that location rule will apply.

    Tip

    To explicitly indicate the start or end of the string to match in a regular expression, use the ^ and $ anchor characters.

  • Rule weight: Rule triggering priority. The lower a rule’s weight, the higher its priority in the user resource configuration. If multiple rules have the same weight, they will be applied in a random order.


    For example, let’s assume you set the following location rules:

    Rule Weight Regular expression Cache lifetime
    A 1 ^/path/.+ 1 hour
    B 2 \.txt$ 4 hours

    With this configuration, the /path/file.txt request will match rule A, which has a lower weight and a higher priority than rule B, so the file will be cached for one hour.

    To cache the /path/file.txt file for four hours, rule B must have a lower weight than rule A.

For the full list of location rule parameters, see the API specification.

You can configure location rules in the management console or using the API. For more information, see Setting up Yandex Cloud CDN location rules.

Useful linksUseful links

  • CDN resource
  • Content caching
  • Request redirection
  • Secure tokens
  • IP-based access policy
  • Setting up Yandex Cloud CDN location rules

Was the article helpful?

Previous
Dedicated IP addressing
Next
Log export
© 2026 Direct Cursus Technology L.L.C.