--- title: "Rules" description: "Control caching, redirects and HTTP headers per path at the edge with prioritised Edge Rules, before requests reach your origin." category: "Deployment" language: en source: https://cubepath.com/docs/products/deployment/cdn-rules updated: 2026-11-17 --- # Edge Rules Open the CDN zone → **Edge Rules** tab in [my.cubepath.com](https://my.cubepath.com). ![Edge rules of a zone ordered by priority](https://cdn.cubepath.com/img/uploads/84fe104b-5649-4fec-839a-35d75439b101.png) Edge Rules change how the CDN handles a request right at the edge, before it ever reaches your origin. They let you control caching, redirects and HTTP headers for specific parts of your site without touching application code, and without a deploy. Every rule belongs to one zone and only affects traffic served through that zone. ## How rules are evaluated Each rule has a **priority** from 1 to 1000, and rules run from the **lowest number to the highest**. A rule at priority 10 is checked before one at 100, so specific rules belong at low numbers and catch-alls at high ones. A rule only acts on requests that **match its conditions**. Leave the conditions empty and it applies to all traffic in the zone. Set several and a request must satisfy **all** of them. ### Matching conditions You can target requests by any combination of: | Condition | Example | |-----------|---------| | **Path** | `/static/*`, `/images/*.jpg` | | **HTTP method** | GET, POST, PUT… | | **Host** | A specific hostname, when the zone serves more than one | | **Headers, query parameters or cookies** | Any name/value | | **Country** | Two-letter code: US, ES, DE | | **IP address or network range** | CIDR | | **User Agent** | A pattern | Any rule can also carry an **expiry date**, after which it stops applying on its own: useful for campaigns and seasonal redirects. And every rule can be switched off without deleting it. ## Rule types ### Cache Sets how long the edge keeps a copy of the matching content. You set an **Edge TTL** (how many seconds our servers keep the file) and optionally a **Browser TTL** (how long the visitor's browser keeps it). ![Cache rule: path pattern with edge and browser TTL](https://cdn.cubepath.com/img/uploads/886735aa-71f6-4e0d-8e09-499884717ee7.png) Longer lifetimes mean fewer trips to your origin, faster pages and lower bandwidth cost. Best for things that rarely change: images, fonts, CSS, JavaScript. ### Cache Bypass Forces matching content to always be fetched fresh and never cached. Use it for anything personalised or transactional: carts, checkout, logged-in dashboards, dynamic API endpoints. > Warning: Getting this wrong is the one CDN mistake that's genuinely dangerous. A cached logged-in page can be served to a different visitor. Bypass cache on every authenticated path before you widen caching anywhere else. ### Redirect Sends visitors elsewhere (a path on the same site or a full URL) as a **permanent** (301, 308) or **temporary** (302, 307) redirect. Use it to retire old URLs, force one canonical hostname, or point a dead page somewhere useful. ![Redirect rule: from path, destination and status code](https://cdn.cubepath.com/img/uploads/46d8063e-5011-49dd-b70d-ebbca77a0c71.png) ### Request Header Adds, changes or removes a header on the request **before it reaches your origin**. Leave the value empty to strip a header. Useful for passing context to your application or cleaning up headers you don't want upstream. ### Response Header Adds, changes or removes a header on the response sent back to the visitor. Leave the value empty to remove one. Common uses: security headers, custom cache hints, CORS headers. ## Good practice - **Start with cache rules on your static assets.** It's the change with the biggest speed and cost benefit for the least effort. - **Always bypass cache on dynamic and logged-in pages**, so no visitor sees content meant for someone else. - **Reserve 301 for moves that are truly permanent.** Browsers and search engines remember them for a very long time; use 302 while you're unsure. - **Use priorities deliberately**: specific paths first, catch-alls last. > Tip: After adding a cache rule, watch the **Cache Hit Rate** in [Analytics](/docs/products/deployment/cdn-analytics). A rule that's matching correctly makes that number climb within minutes; if it doesn't move, your conditions aren't matching what you think they are. To control *who* can reach your content and how much traffic they can send, see [WAF](/docs/products/deployment/cdn-waf).