Introduction
Requestly allows users to define multiple conditions within a single rule, making request modifications easier. Instead of creating separate rules for each scenario, you can configure a single rule to handle multiple actions, targeting multiple URLs at once in a single rule.
How Multiple Conditions Work
Requestly evaluates multiple conditions within a single rule independently. If a condition matches, the corresponding action is executed. This allows users to apply different modifications without needing separate rules for each case.
Redirect Rule
The Redirect Rule in Requestly allows users to define multiple conditions within a single rule, enabling different URLs to be redirected to different destinations. Instead of creating separate redirect rules for each URL, you can consolidate multiple redirections into one rule for better organization and efficiency.
Key Points to Remember
-
Each condition is evaluated independently.
-
If multiple conditions match the same request, the first defined condition in the rule takes precedence.
Replace Rule
The Replace Rule in Requestly allows users to define multiple conditions within a single rule to modify different parts of a URL dynamically. Instead of creating separate replace rules for different replacements, you can manage them all in one rule, ensuring efficient and flexible URL transformations.
Key Points to Remember
-
Each condition is evaluated independently, meaning multiple replacements can be applied to the same request.
-
If multiple conditions modify overlapping parts of the URL, they execute in the order they are defined in the rule.
Query Param Rule
The Query Param Rule in Requestly allows users to define multiple conditions within a single rule to modify query parameters in different URLs. Instead of manually appending, updating, or removing query parameters in multiple rules, you can consolidate all changes into one rule .
Key Points to Remember
-
Each condition applies independently based on the matching URL pattern.
-
If a query parameter is added and then modified later, the modified value will be the final one applied.
Modify Headers Rule
The Modify Headers Rule in Requestly allows users to define multiple conditions within a single rule to add, modify, or remove HTTP headers across different URLs. Instead of creating multiple rules for different header modifications, you can consolidate them into one rule, ensuring efficiency and better rule management.
Key Points to Remember
-
Each condition applies independently to the matching URLs.
-
Header modifications follow the order they are listed. If a header is added first and then modified, the modified value will be the final one applied.
Modify User Agent
The Modify User Agent Rule in Requestly allows users to define multiple conditions within a single rule to modify the User-Agent header for different URLs. This is particularly useful for testing how a website behaves across different browsers, devices, and platforms without needing to use actual devices or browser extensions.
Key Points to Remember
-
Each condition applies independently to the matching URLs.
-
If multiple conditions match the same URL, the last matching condition will take precedence.
-
The modified User-Agent is sent with all requests to the specified URLs, affecting how servers respond.
Cancel Request Rule
The Cancel Request Rule in Requestly allows users to define multiple conditions within a single rule to block specific requests based on different URLs. This is useful for preventing unnecessary or harmful requests, improving performance, and ensuring a cleaner browsing or testing environment.
Key Points to Remember
-
Each condition applies independently to the matching URLs.
-
Once a request is canceled, no further processing occurs for that request.
-
The rule applies to both browser requests and API calls, ensuring unwanted requests are blocked across different scenarios.
Delay Network Request Rule
The Delay Network Request Rule in Requestly allows users to define multiple conditions within a single rule to artificially delay specific requests. This is useful for testing how applications behave under slow network conditions or simulating real-world latency issues.
Key Points to Remember
-
Each condition applies independently to the matching URLs.
-
Delays apply only to matched requests, meaning unrelated requests remain unaffected.
-
Requests are paused before reaching the server, simulating real-world latency.
Insert Script Rule
Insert Script rule allows you to insert multiple scripts and styles on a single page all the scripts are executed serially, You define a single condition, specifying the URL where the scripts should be injected. Multiple JavaScript and CSS files can be added to that page. Scripts and styles execute serially, in order, ensuring dependencies are handled correctly.
How It Works
-
You define a single condition, specifying the URL where the scripts should be injected.
-
Multiple JavaScript and CSS files can be added to that page.
-
Scripts and styles execute serially, in order, ensuring dependencies are handled correctly.
Key Points to Remember
-
Single Condition: The rule applies to one URL pattern only.
-
Multiple Scripts and Styles: You can inject multiple JavaScript and CSS files.
-
Serial Execution: Scripts run one after another, following the specified order.
-
Ensuring Dependencies: If one script depends on another, place it later in the order.
Best Practices
-
Load Dependencies First: If a script relies on another (e.g., jQuery), inject it before dependent scripts.
-
Use Minified Versions: For better performance, use minified .js and .css files.
-
Avoid Blocking UI: Large scripts should be loaded asynchronously when possible.
-
Test in Requestly: Use the Test Rule feature to ensure scripts load in the right sequence.