Edge Rules for Your CDN Zone
Edge Rules let you change how the CDN handles each request right at the edge, before it ever reaches your origin server. With them you control caching, redirects, and HTTP headers for specific parts of your site, without touching your application code.
You manage Edge Rules from the CubePath dashboard. Open your CDN zone, go to the Rules tab, and add the rules you need. Every rule belongs to one zone and applies only to traffic served through that zone.
How rules are evaluated
Each rule has a priority number (from 0 to 65535). Rules run in order from the lowest number to the highest, so a rule with priority 10 is checked before one with priority 100. Give your most specific rules a lower number so they take effect before broader ones.
A rule only acts on the requests that match its conditions. If you leave the conditions empty, the rule applies to all traffic in the zone. When you set several conditions, a request must satisfy all of them to match.
Matching conditions
You can target requests by any combination of:
- Path: a pattern such as
/static/*or/images/*.jpg - HTTP method: GET, POST, PUT, and so on
- Host: a specific hostname, useful when your zone serves more than one
- Headers, query parameters, or cookies
- Country: the visitor's country by two letter code (US, ES, DE)
- IP address or network range (CIDR)
- User Agent pattern
You can also set an expiry date on any rule. After that moment the rule stops applying on its own, which is handy for temporary campaigns or seasonal redirects. Every rule can be turned on or off at any time without deleting it.
Rule types
Cache
Tells the edge how long to keep a cached copy of the matching content. You set an edge cache lifetime (how long our servers keep the file) and, optionally, a browser cache lifetime (how long the visitor's browser keeps it). Longer lifetimes mean fewer trips to your origin, faster pages, and lower bandwidth cost. Best for assets that rarely change, like images, fonts, CSS, or JavaScript.
Cache Bypass
Forces the matching content to always be fetched fresh from your origin and never cached. Use it for pages that must always be current, such as a cart, a checkout, a logged in dashboard, or a dynamic API endpoint.
Redirect
Sends visitors from one location to another. You choose the destination (a path on the same site or a full URL) and the type of redirect: permanent (301 or 308) or temporary (302 or 307). Use it to move old URLs to new ones, force a single canonical hostname, or point a retired page somewhere useful.
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 extra context to your application or cleaning up headers you do not want.
Response Header
Adds, changes, or removes a header on the response we send back to the visitor. Leave the value empty to remove one. Common uses are security headers, custom cache hints, and CORS headers.
A few good practices
- Start with cache rules on your static assets. It is the change that gives the biggest speed and cost benefit for the least effort.
- Always bypass cache on dynamic and logged in pages so visitors never see content meant for someone else.
- Keep redirects permanent (301) only when the move is truly permanent, since browsers and search engines remember them for a long time.
- Use priorities deliberately: specific paths first, catch all rules last.
Next steps
Open your CDN zone in the dashboard and add your first cache rule on a folder of static files. Then check the zone analytics to watch your cache hit rate climb as more requests are served straight from the edge. To control who can reach your content and how much traffic they can send, see the companion guide on WAF Rules.
