Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • 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
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Cloud CDN
  • Getting started
    • Overview
    • Providers
    • Resource
    • Origins and origin groups
    • Redirecting requests
    • Content caching
    • Secure tokens
    • IP-based access policy
    • Location rules
    • Log export
    • Labels
    • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics for the EdgeCDN provider
  • Monitoring metrics for the Yandex Cloud CDN provider
  • Audit Trails events
  • Release notes
  • Troubleshooting
  1. Concepts
  2. Location rules

Location rules Yandex Cloud CDN

Written by
Yandex Cloud
Updated at December 3, 2025

Warning

The location rule functionality is only available through the Yandex Cloud CDN provider.

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:

  • Content caching
  • Redirecting requests
  • 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

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 details, see Setting additional parameters.

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.

See alsoSee also

  • CDN resource
  • CDN providers
  • Content caching
  • Redirecting requests
  • Secure tokens
  • IP-based access policy
  • Setting up Yandex Cloud CDN location rules

Was the article helpful?

Previous
IP-based access policy
Next
Log export
© 2025 Direct Cursus Technology L.L.C.