Edge Rules
Edge Rules
Define custom logic that executes at the Edge on every request. Redirect URLs, rewrite paths, and manipulate headers before requests reach your origin.
Available rule types
Redirect
Send visitors to another URL with 301/302.
URL Rewrite
Change the path transparently to visitors.
Cache Control
Override TTL for specific URL patterns.
Request Header
Add/Remove headers before origin.
Response Header
Add/Remove headers before visitor.
Block / Allow
Control access based on conditions.
How to create an Edge Rule
1
Define Condition
What triggers this rule (URL path, Header, Country, IP).
2
Set Action
What happens when the condition is met (Redirect, Rewrite, etc).
3
Set Priority
Rules are evaluated from lowest to highest priority number.
Rules are compiled into edge configuration and hot-reloaded into cache automatically with zero downtime.
Real-world examples
Redirect Old Blog
Condition: URL path starts with /old-blog/
Action: Redirect → /blog/ (301)
Security Headers
Condition: Always
Action: Add Response Header
X-Frame-Options: SAMEORIGIN
Cache Override
Condition: URL starts with /api/public/
Action: Set Cache TTL = 30s
Transparent Rewrite
Condition: /products/
Action: Rewrite → /shop/items/
Visitor sees /products/, origin receives /shop/items/