The advanced request targeting feature helps you define better targeting conditions and restrict rules to be applied on specific web pages (or domains), request types, request methods, or request payloads. It provides more control over how you can use the rules
To apply advanced targeting:
- Go to Requestly Dashboard.
- Create any new rule.
- On the rule editor, click the funnel icon to open Source Filter.
The Source filter has 3 ways of advanced targeting methods to modify network requests:
- Page URL
- Resource Type
- Resource Method
First you can select page URL on which you want to add source filter. There are 4 ways to add your page URL of the site on which you want to apply this filter.
It let's you apply your rule to a particular website instead of all the websites you open in your browser. In the select drop-down you will see 4 options. below is described how you can use them.
Page URL Targeting
Page URL based targeting allows developers to restrict requestly rules to be applied when the request URL originates from within the targeted page URL (or domain) only. There are 4 ways to add your page URL of the site on that you want to apply this filter: Equals
, Contains
, Matches (Regex)
, and Matches (Wildcard)
.
Resource Type Targeting
Here, you can select the type of the file on which you want to apply your rule. By default, all types of files will be selected.
Example 1 If you want to block all the images that appear on a particular website, you can do so by selecting Resource type as Image.
Example 2 You want to block all the CSS file that load on a particular website than you can select CSS in Resource Type to do so. It will block all CSS file on that website.
Request Method
Here, you can modify a particular type on network request going from your desired website. By default it will apply on all types of network requests.
EXAMPLE If you want to block a particular GET Request going from the desired site you can do it from here.
Request Payload Targeting
Currently, Request Payload is available only for Response modification rules. It allows you to target a request based on the data that is sent along with it.
In case of a GET request, the data would be matched from the search parameters (a.k.a. query string). In a POST request, the request body will be used for targeting (currently supports only JSON data).
You can use JSON-like syntax for targeting as shown below: