How Edge Rules Are Ordered
Edge Rules execute in the order defined by the OrderIndex. Rules are always processed from the smallest to the largest OrderIndex value:
- A rule with
OrderIndex = 1 will execute before a rule with OrderIndex = 2.
- All rules are executed sequentially based on their index.
This allows you to control which rules should apply first, which is especially important when multiple rules affect the same headers or behaviors.
Default Behavior: What Happens if No OrderIndex Is Set?
If you do not specify an OrderIndex for your Edge Rules:
- Rules will execute in the order they were created.
Because of this, we strongly recommend setting an explicit OrderIndex for all rules to ensure predictable and consistent execution order.
Short-Circuiting vs. Multi-Action Execution
Edge rules process actions differently depending on the action type.
Some actions follow a short-circuiting model, where only the first matching action of that type is executed, and further actions of that same type are ignored. This behavior applies when executing multiple actions of the same kind would cause conflicts or unintended side effects.
Other actions support multi-action execution, meaning all matching actions of that type are processed, in sequence. This is typical for additive behaviors like setting response headers or appending cookies, where multiple values can coexist.
We will add either the π(short-circuiting model) or π(multi-action execution) icon to the action list below to indicate how each action is processed.
Example Behaviors
If multiple rules modify the same request or response header, all matching actions will be executed, allowing cumulative changes.
If multiple rules attempt to rewrite the URL or redirect, only the first matching action is executed, and subsequent conflicting actions are skipped.
Example:
| OrderIndex | Condition | Action |
|---|
| 1 | If Request URL equals /images | Override Browser Cache Time -> 3600 |
| 2 | if Request URL equals /images | SetResponseHeader -> hello=world |
| 3 | If Request Header -> User-Agent contains Googlebot | Override Browser Cache Time -> 5 |
| 4 | if Request Header -> User-Agent contains Google | SetResponseHeader -> hello2=world2 |
If a request matches both conditions:
- The
Cache-Control value will be 3600, because Override Browser Cache Time is a π short-circuiting action and the first match (OrderIndex = 1) wins.
- Both
SetResponseHeader actions will execute, resulting in hello and hello2 headers being added.
Edge Rule Execution Layers (Cache vs Origin)
Edge Rules execute in two distinct stages of the request lifecycle:
- Cache Layer - evaluated on every request, before cache lookup and cache decision are finalized
- Proxy (Origin) Layer - evaluated only if the request goes to origin (CACHE MISS or BYPASS)
The Cache Layer is always executed, regardless of whether the request results in a CACHE HIT or MISS.The Proxy (Origin) Layer is only executed when the request cannot be served from cache.
Request Flow Overview
A request is processed in the following order:
- Edge Rules (Cache Layer)
- Cache Lookup (HIT or MISS)
- Edge Rules (Proxy/Origin Layer, only on MISS/BYPASS)
- Origin Request (if needed)
Cache Layer Execution (Always Runs):
The following Edge Rules are evaluated at the Cache Layer, meaning they run on every request before cache resolution, regardless of whether the final result is a HIT or MISS.
ForceSSL (Enum Value: 0) π
Redirect (Enum Value: 1) π
OverrideCacheTime (Enum Value: 3) π Note: if set to0 it will bypass edge cache, if we donβt already have the content cached on our edge.
BlockRequest (Enum Value: 4) π
SetResponseHeader (Enum Value: 5) π
ForceDownload (Enum Value: 7) π
DisableTokenAuthentication (Enum Value: 8) π
EnableTokenAuthentication ( Enum Value: 9) π
OverrideCacheTimePublic (Enum Value: 10) π
IgnoreQueryString (Enum Value: 11) π
DisableOptimizer (Enum Value: 12) π
ForceCompression (Enum Value: 13) π
SetStatusCode (Enum Value: 14) π
OverrideBrowserCacheTime (Enum Value: 16) π
SetNetworkRateLimit (Enum Value: 18) π
SetConnectionLimit (Enum Value: 19) π
SetRequestsPerSecondLimit (Enum Value: 20) π
OverrideBrowserCacheResponseHeader (Enum Value: 25) π
RemoveBrowserCacheResponseHeader (Enum Value: 26) π
DisableShieldChallenge (Enum Value: 27) π
Proxy (Origin) Layer Execution (MISS/BYPASS Only):
The following Edge Rules are evaluated only when the request reaches the origin, meaning:
- Cache MISS
- Cache BYPASS (e.g. due to rules or headers)
These rules are not executed on cache hits, as no origin request is made.
OriginUrl (Enum Value: 2) π
OverrideCacheTime (Enum Value: 3) π
SetResponseHeader (Enum Value: 5) π
SetRequestHeader (Enum Value: 6) π
BypassPermaCache (Enum Value: 15) π
OriginStorage (Enum Value: 17) π
RunEdgeScript (Enum Value: 21) π
OriginMagicContainers (Enum Value: 22) π
DisableWAF (Enum Value: 23) π
RetryOrigin (Enum Value: 24) π
DisableShieldChallenge (Enum Value: 27) π
DisableShieldBotDetection (Enum Value: 29) π
BypassAwsS3Authentication (Enum Value: 30) π
Setting the Execution Order
Method 1: Dashboard (Drag & Drop)
You can reorder your Edge Rules visually:
- Go to your Pull Zone > Edge Rules tab.
- Click βReorderβ badge at the top of the page.
- Drag rules to change their order.
- The order you set will automatically adjust the OrderIndex behind the scenes.
Method 2: API (Set OrderIndex Directly)
If you manage rules programmatically via our API, you can set the execution order by adjusting the OrderIndex value when creating or updating an edge rule.
Best Practices
- Plan rule priorities carefully, especially when multiple rules affect the same property or header.
- Keep related rules grouped and ordered for easier maintenance.
- Use the dashboard for visual management and the API for bulk or automated updates.