diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 46c14a915a0..bb3ff52464e 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -564,40 +564,24 @@ If you want the rule not to be applied to certain domains, start a domain name w **`$domain` modifier matching target domain:** -In some cases the `$domain` modifier can match not only the referrer domain, but also the target domain. This happens when all the following conditions are met: +In some cases the `$domain` modifier can match not only the referrer domain, but also the target domain. -1. The request has the `document` content type -1. The rule pattern does not match any particular domains -1. The rule pattern does not contain regular expressions -1. The `$domain` modifier contains only excluded domains, e.g. `$domain=~example.org|~example.com` +This happens when the rule has one of the following modifiers: [`$cookie`](#cookie-modifier), [`$csp`](#csp-modifier), [`$permissions`](#permissions-modifier), [`$removeparam`](#removeparam-modifier). -The following predicate should be satisfied to perform a target domain matching: - -```text -1 AND ((2 AND 3) OR 4) -``` - -That is, if the modifier `$domain` contains only excluded domains, then the rule does not need to meet the second and third conditions to match the target domain against the modifier `$domain`. - -If some of the conditions above are not met but the rule contains [`$cookie`](#cookie-modifier) or [`$csp`](#csp-modifier) modifier, the target domain will still be matched. - -If the referrer matches a rule with `$domain` that explicitly excludes the referrer domain, then the rule will not be applied even if the target domain also matches the rule. This affects rules with [`$cookie`](#cookie-modifier) and [`$csp`](#csp-modifier) modifiers, too. +These modifiers will not be applied if the referrer matches a rule with `$domain` that explicitly excludes the referrer domain, even if the target domain also matches the rule. **Examples** - `*$cookie,domain=example.org|example.com` will block cookies for all requests to and from `example.org` and `example.com`. -- `*$document,domain=example.org|example.com` will block all requests to and from `example.org` and `example.com`. +- `*$document,domain=example.org|example.com` will block requests only from `example.org` and `example.com`, but not to them. In the following examples it is implied that requests are sent from `http://example.org/page` (the referrer) and the target URL is `http://targetdomain.com/page`. - `page$domain=example.org` will be matched, as it matches the referrer domain. -- `page$domain=targetdomain.com` will be matched, as it matches the target domain and satisfies all requirements mentioned above. -- `||*page$domain=targetdomain.com` will not be matched, as the pattern `||*page` may match specific domains, -e.g. `example.page`. +- `page$domain=targetdomain.com` will not be matched because it does not match the referrer domain. - `||*page$domain=targetdomain.com,cookie` will be matched because the rule contains `$cookie` modifier despite the pattern `||*page` may match specific domains. -- `/banner\d+/$domain=targetdomain.com` will not be matched as it contains a regular expression. -- `page$domain=targetdomain.com|~example.org` will not be matched because the referrer domain is explicitly excluded. +- `page$domain=targetdomain.com|~example.org,cookie` will not be matched because the referrer domain is explicitly excluded. ##### `$domain` modifier limitations {#domain-modifier-limitations}