One major benefit of using multiple rules is that it allows you to exercise both coarse and granular control over how requests for your assets are handled. For example, you could create a rule that determines the default manner through which all requests are handled. After which, you could create a set of rules that determine how certain types of requests are handled for a particular location. In order for this type of configuration to work properly, you will need to pay attention to the order in which these rules are listed.
The order in which multiple rules are listed affects how they are handled. Rules are typically processed in the order that they appear. If a client's request satisfies the criteria for more than one rule, then the features associated with the matching criteria for each rule will take place. This could lead to a situation where conflicting actions will take place. In such a case, the last action to take place will take precedence over previous actions. Therefore, it is recommended that you place rules that should take precedence as close to the bottom of the list as possible.
The following illustration contains four sample rules that provide different instructions based on the type of request being performed. In this sample scenario, we'll assume that the client requests an HTML asset from the "Secure" folder on "mydomain.com." This type of request will satisfy the match criteria for all four rules. Therefore, the features associated with each of the rules will be applied to the request. If one or more rules contain conflicting instructions, then the rule closest to the bottom of the list will take precedence. In this sample scenario, the rule called "Apply to All HTML Requests for "mydomain.com" in "Secure" Folder" would take precedence over the other rules.
Tip: A good rule of thumb when determining where a rule should be placed is to order rules according to the level of detail in the criteria. Rules with general criteria should be placed closer to the top of the list, while more detailed criteria should be placed closer to the bottom. This type of configuration allows your catch-all rules to assign default handling behavior for your assets without interfering with the manner in which specific types of assets are handled.
Important: There is an exception to the order-based rule precedence stated above. If the top-level matching criteria for a rule are the same as that of another rule, then the actions associated with those two rules will take place at the same time. Thus, a rule at the bottom could be combined with a rule at the top of the list. This type of situation would prevent the rule at the bottom from taking precedence over other rules. View a detailed example.