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 = 1will execute before a rule withOrderIndex = 2. - All rules are executed sequentially based on their index.
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.
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 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 |
Cache-Control header will ultimately be set to 3600 because the rule with OrderIndex = 1 executes first and short circuits, while theyβll be two new response headers, hello and hello2.
Cached vs Non-Cached Edge Rule Execution
You also need to factor into your edge rule creation and execution whether the content will become cached or not, below is our list of Edge Rules that will execute uponCACHE: HIT and additionally, CACHE: MISS.
Executing Rules on a CACHE HIT (Cache Layer):
ForceSSL(Enum Value:0) πRedirect(Enum Value:1) πOverrideCacheTime(Enum Value:3) π Note: if set to0it 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) π
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 theOrderIndex 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.