From 78ce62251eeb7bd6cd197045f8891422944f904e Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Tue, 15 Sep 2020 19:09:30 +0300 Subject: [PATCH 1/9] `domain` modificator with document` request type (EN) --- .../02.how-to-create-your-own-ad-filters/docs.en.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index c7963bee..226a5e1f 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -333,6 +333,15 @@ If you want the rule not to be applied to certain domains, start a domain name w * `||baddomain.com^$domain=~example.org` — a rule to block requests that match the specified mask, and are sent from any domain except `example.org` or it's subdomains. * `||baddomain.com^$domain=example.org|~foo.example.org` — this rule blocks requests that are sent from `example.org` and all it's subdomains, except the subdomain `foo.example.org`. +###### `domain` and requests with `document` type + +When a request has `document` type, rules with `domain` modifier behave differently. In the following examples it's 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. +* `||page^$domain=~example.org` will not be matched, as it explicitly excludes `example.org`. +* `||page^$domain=targetdomain.com` will be matched, as it matches the target URL. This will not be true for all other types of requests. + + ##### **`third-party`** From a73baec3e68489d2834c9583fca21a6b3f40c0a9 Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Tue, 15 Sep 2020 19:17:14 +0300 Subject: [PATCH 2/9] `domain` modifier with document-type requests (RU) --- .../02.how-to-create-your-own-ad-filters/docs.en.md | 2 +- .../02.how-to-create-your-own-ad-filters/docs.ru.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index 226a5e1f..24de03fe 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -337,7 +337,7 @@ If you want the rule not to be applied to certain domains, start a domain name w When a request has `document` type, rules with `domain` modifier behave differently. In the following examples it's 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. +* `||page^$domain=example.org` will be matched, as it matches the referrer. * `||page^$domain=~example.org` will not be matched, as it explicitly excludes `example.org`. * `||page^$domain=targetdomain.com` will be matched, as it matches the target URL. This will not be true for all other types of requests. diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md index 2b6dcce0..ae20a203 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md @@ -335,6 +335,15 @@ pattern = "/" regexp "/" * `||baddomain.com^$domain=~example.org` — правило для блокировки запросов, которые соответствуют указанной маске, и отправленных с любого домена, кроме `example.org` и его поддоменов. * `||baddomain.com^$domain=example.org|~foo.example.org` — в данном примере правило будет соответствовать запросам, отправленным с домена `example.org` и всех его поддоменов, кроме поддомена `foo.example.org`. +###### `domain` и запросы с типом `document` + +Когда запрос имеет тип `document`, правила с модификатором `domain` ведут себя иначе. В следующих примерах предполагается, что запросы посылаются с `http://example.org/page` (реферер), а целевой URL — `http://targetdomain.com/page`. + +* Правило `||page^$domain=example.org` сработает, поскольку под него подпадает реферер запроса. +* Правило `||page^$domain=~example.org` не сработает, поскольку оно явно исключает `example.org`. +* Правило `||page^$domain=targetdomain.com` сработает, поскольку под него подпадает целевой URL. Это не так для всех остальных типов запросов. + + ##### **`third-party`** From a9977764287872cac6bf4e2dbcf543190812efb1 Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Tue, 15 Sep 2020 19:24:00 +0300 Subject: [PATCH 3/9] content blocking rules update --- 01.general/02.how-to-create-your-own-ad-filters/docs.en.md | 3 +-- 01.general/02.how-to-create-your-own-ad-filters/docs.ru.md | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index 24de03fe..c8d3faf4 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -341,7 +341,6 @@ When a request has `document` type, rules with `domain` modifier behave differen * `||page^$domain=~example.org` will not be matched, as it explicitly excludes `example.org`. * `||page^$domain=targetdomain.com` will be matched, as it matches the target URL. This will not be true for all other types of requests. - ##### **`third-party`** @@ -496,7 +495,7 @@ Disables any cosmetic rules on the pages matching the rule. You will find the in ##### **`content`** -Disables HTML filtering rules on the pages matching the rule. You will find the information about HTML filtering rules [further](#html-filtering-rules). +Disables HTML filtering rules and replace rules on the pages that match the rule. You will find the information about HTML filtering rules [here](#html-filtering-rules) and about replace rules [here](#replace-modifier). ###### `content` example diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md index ae20a203..6eebf0e4 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md @@ -498,7 +498,7 @@ AdGuard будет пытаться закрыть браузерную вкла ##### **`content`** -Отключает правила фильтрации HTML-элементов на страницах, подходящих под правило. О правилах фильтрации HTML-элементов речь [пойдет ниже](#html-filtering-rules). +Отключает правила фильтрации HTML-элементов и replace-правила на страницах, подходящих под правило. О правилах фильтрации HTML-элементов речь пойдёт [здесь](#html-filtering-rules), а о replace-правилах — [здесь](#replace-modifier). ###### Примеры `content` From fb3f985c05b13ccacc67b33d9de1ede1abb86f97 Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Thu, 1 Jul 2021 20:04:19 +0300 Subject: [PATCH 4/9] domain modifier update --- .../docs.en.md | 25 +++++++++++++++---- .../docs.ru.md | 24 ++++++++++++++---- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index c8d3faf4..73fdeda8 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -333,13 +333,28 @@ If you want the rule not to be applied to certain domains, start a domain name w * `||baddomain.com^$domain=~example.org` — a rule to block requests that match the specified mask, and are sent from any domain except `example.org` or it's subdomains. * `||baddomain.com^$domain=example.org|~foo.example.org` — this rule blocks requests that are sent from `example.org` and all it's subdomains, except the subdomain `foo.example.org`. -###### `domain` and requests with `document` type +###### `domain` modifier matching target domain -When a request has `document` type, rules with `domain` modifier behave differently. In the following examples it's implied that requests are sent from `http://example.org/page` (the referrer), and the target URL is `http://targetdomain.com/page`. +In some cases the `$domain` modifier can match not only the referer domain, but also the target domain. This happens when all of the following is true: + +1) The request has `document` type +2) The rule's pattern doesn't match any particular domain(s) +3) The rule's pattern doesn't contain regular expressions + +When all these conditions are met, the `domain` modifier will match both the referer doman **and** the target domain. + +**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`. + +In the following examples it's implied that requests are sent from `http://example.org/page`(the referer) and the target URL is `http://targetdomain.com/page`. + +* `page$domain=example.org` will be matched, as it matches the referer domain. +* `page$domain=targetdomain.com` will be matched, as it matches the target domain but satisfies all requirements mentioned above. +* `||page^$domain=targetdomain.com` will not be matched, as the pattern `||page^` matches specific domains. +* `/banner\d+/$domain=targetdomain.com` will not be matched as it contains a regular expression. -* `||page^$domain=example.org` will be matched, as it matches the referrer. -* `||page^$domain=~example.org` will not be matched, as it explicitly excludes `example.org`. -* `||page^$domain=targetdomain.com` will be matched, as it matches the target URL. This will not be true for all other types of requests. ##### **`third-party`** diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md index 6eebf0e4..a0ac3be5 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md @@ -335,13 +335,27 @@ pattern = "/" regexp "/" * `||baddomain.com^$domain=~example.org` — правило для блокировки запросов, которые соответствуют указанной маске, и отправленных с любого домена, кроме `example.org` и его поддоменов. * `||baddomain.com^$domain=example.org|~foo.example.org` — в данном примере правило будет соответствовать запросам, отправленным с домена `example.org` и всех его поддоменов, кроме поддомена `foo.example.org`. -###### `domain` и запросы с типом `document` +###### Когда `domain` соответствует целевому домену -Когда запрос имеет тип `document`, правила с модификатором `domain` ведут себя иначе. В следующих примерах предполагается, что запросы посылаются с `http://example.org/page` (реферер), а целевой URL — `http://targetdomain.com/page`. +В некоторых случаях модификатор `$domain` может соответствовать не только домену-рефереру, но и целевому домену. Это происходит в случае, когда всё из перечисленного верно: -* Правило `||page^$domain=example.org` сработает, поскольку под него подпадает реферер запроса. -* Правило `||page^$domain=~example.org` не сработает, поскольку оно явно исключает `example.org`. -* Правило `||page^$domain=targetdomain.com` сработает, поскольку под него подпадает целевой URL. Это не так для всех остальных типов запросов. +1) Запрос имеет тип `document` +2) Паттерн правила не соответствует какому-либо или каким-либо конкретным доменам +3) Паттерн правила не содержит регулярных выражений + +Если все условия выполнены, модификатор `domain` будет соответствовать как рефереру, так и целевому домену. + +**Примеры:** + +* `*$cookie,domain=example.org|example.com` заблокирует cookies для всех запросов от и к `example.org` и `example.com`. +* `*$document,domain=example.org|example.com` заблокирует все запросы от и к `example.org` и `example.com`. + +В следующих примерах предполагается, что запросы отправляются от `http://example.org/page`(реферер), а целевой URL - `http://targetdomain.com/page`. + +* `page$domain=example.org` сработает, так как соответствует рефереру. +* `page$domain=targetdomain.com` сработает, так как соответствует целевому домену, но выполнены все условия, перечисленные выше. +* `||page^$domain=targetdomain.com` не сработает, поскольку паттерн `||page^` указывает на конкретные домены. +* `/banner\d+/$domain=targetdomain.com` не сработает, поскольку правило содержит регулярное выражение. From f0b634d9b82ef56b942da9ed26dd4fa7175515a8 Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Fri, 2 Jul 2021 15:59:26 +0300 Subject: [PATCH 5/9] $domain modifier fix --- 01.general/02.how-to-create-your-own-ad-filters/docs.en.md | 5 ++++- 01.general/02.how-to-create-your-own-ad-filters/docs.ru.md | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index 73fdeda8..d7c06233 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -343,6 +343,8 @@ In some cases the `$domain` modifier can match not only the referer domain, but When all these conditions are met, the `domain` modifier will match both the referer doman **and** the target domain. +>If some of the conditions above aren't met but the rule contains modifiers `cookie` or `csp`, the target domain will still be matched. + **Examples:** * `*$cookie,domain=example.org|example.com` will block cookies for all requests to and from `example.org` and `example.com`. @@ -352,7 +354,8 @@ In the following examples it's implied that requests are sent from `http://examp * `page$domain=example.org` will be matched, as it matches the referer domain. * `page$domain=targetdomain.com` will be matched, as it matches the target domain but satisfies all requirements mentioned above. -* `||page^$domain=targetdomain.com` will not be matched, as the pattern `||page^` matches specific domains. +* `||*page$domain=targetdomain.com` will not be matched, as the pattern `||*page` matches specific domains. +* `||*page$domain=targetdomain.com,cookie` will be matched despite the pattern `||*page` matches specific domains because it contains `$cookie` modifier. * `/banner\d+/$domain=targetdomain.com` will not be matched as it contains a regular expression. diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md index a0ac3be5..d404879b 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md @@ -345,6 +345,8 @@ pattern = "/" regexp "/" Если все условия выполнены, модификатор `domain` будет соответствовать как рефереру, так и целевому домену. +>Если какие-либо из условий выше не выполнены, но правило содержит модификатор `cookie` или `csp`, модификатор `domain` всё равно будет соответствовать целевому домену. + **Примеры:** * `*$cookie,domain=example.org|example.com` заблокирует cookies для всех запросов от и к `example.org` и `example.com`. @@ -354,7 +356,8 @@ pattern = "/" regexp "/" * `page$domain=example.org` сработает, так как соответствует рефереру. * `page$domain=targetdomain.com` сработает, так как соответствует целевому домену, но выполнены все условия, перечисленные выше. -* `||page^$domain=targetdomain.com` не сработает, поскольку паттерн `||page^` указывает на конкретные домены. +* `||*page$domain=targetdomain.com` не сработает, поскольку паттерн `||*page` указывает на конкретные домены. +* `||*page$domain=targetdomain.com,cookie` сработает несмотря на то, что паттерн `||*page` указывает на кокретные домены, поскольку правило содержит модификатор `$cookie`. * `/banner\d+/$domain=targetdomain.com` не сработает, поскольку правило содержит регулярное выражение. From 7e25be311b9eb817eacce21a96b336f918b1d47c Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Fri, 2 Jul 2021 16:45:33 +0300 Subject: [PATCH 6/9] $badfilter modifier updated --- .../docs.en.md | 22 ++++++++++++++----- .../docs.ru.md | 22 ++++++++++++++----- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index d7c06233..9c9eb9d4 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -721,20 +721,30 @@ If a request to `example.org` is sent from the `test.org` domain, the rule won't #### **`badfilter`** -> #### Compatibility with different versions of AdGuard -> `badfilter` modifier is currently only available in AdGuard browser extensions. It will be added to other AdGuard products later. - The rules with the `badfilter` modifier disable other basic rules to which they refer. It means that the text of the disabled rule should match the text of the `badfilter` rule (without the `badfilter` modifier). -##### `badfilter` examples +**Examples:** * `||example.com$badfilter` disables `||example.com` * `||example.com$image,badfilter` disables `||example.com,image` * `@@||example.com$badfilter` disables `@@||example.com` * `||example.com$domain=domain.com,badfilter` disables `||example.com$domain=domain.com` -> #### Compatibility with different versions of AdGuard -> Below modifiers from this section are only available in AdGuard for Windows, macOS and Android. Browser extension capabilities are limited by browser itself and some methods are just not available to them. +Rules with `$badfilter` modifier can disable other basic rules for specific domains if they fulfil the following conditions: + +* The rule has a `$domain` modifier +* The rule does not have a negated domain `~` in `$domain` modifier's value. + +In that case, the `$badfilter` rule will disable the corresponding rule for domains specified in both the `$badfilter` and basic rules. Please note, that [wildcard-TLD logic](https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#wildcard-for-tld) works here as well. + +**Examples:** + +* `/some$domain=example.com|example.org|example.io` is disabled for `example.com` by `/some$domain=example.com,badfilter` +* `/some$domain=example.com|example.org|example.io` is disabled for `example.com` and `example.org` by `/some$domain=example.com|example.org,badfilter` +* `/some$domain=example.com|example.org` and `/some$domain=example.io` are disabled completely by `/some$domain=example.com|example.org|example.io,badfilter` +* `/some$domain=example.com|example.org|example.io` is disabled completely by `/some$domain=example.*,badfilter` +* `/some$domain=example.*` is disabled for `example.com` and `example.org` by `/some$domain=example.com|example.org,badfilter` +* `/some$domain=example.com|example.org|example.io` is NOT disabled for `example.com` by `/some$domain=example.com|~example.org,badfilter` because the value of `domain` modifier contains a negated domain #### **`empty`** diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md index d404879b..fe74e250 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md @@ -722,20 +722,30 @@ removeparam = "/" regex "/" options ##### **`badfilter`** -> #### Совместимость с разными версиями AdGuard -> Модификатор `badfilter` на данный момент работает только в браузерных расширениях AdGuard. Мы планируем в скором времени добавить поддержку этого модификатора и другими продуктами AdGuard. - Правила, содержащие модификатор `badfilter`, отключают базовые правила, на которые они ссылаются. Это означает, что текст отключенного правила должен соответствовать тексту `badfilter`-правила (за исключением самого модификатора `badfilter`). -###### Примеры `badfilter` +**Примеры:** * `||example.com$badfilter` отключает `||example.com` * `||example.com$image,badfilter` отключает `||example.com,image` * `@@||example.com$badfilter` отключает `@@||example.com` * `||example.com$domain=domain.com,badfilter` отключает `||example.com$domain=domain.com` -> #### Совместимость с разными версиями AdGuard -> Модификаторы ниже из этого раздела доступны только в AdGuard для Windows, macOS и Android. Браузерные расширения ограничены возможностями, предоставляемыми браузерами, и некоторые функции им просто недоступны. +Правила с модификатором `$badfilter` могут отключать другие базовые правила для определённых доменов, если они выполняют следующие условия: + +* Правило имеет модификатор `$domain` +* Правило не имеет отрицания домена `~` в значении модификатора `$domain`. + +В этом случае, правило с `$badfilter` отключит соответствующее базовое правило для доменов, указанных как в правиле с `$badfilter`, так и в базовом правиле. Обратите внимание, что [логика wildcard для доменов верхнего уровня (TLD)](https://kb.adguard.com/ru/general/how-to-create-your-own-ad-filters#wildcard-for-tld) здесь также применима. + +**Примеры:** + +* `/some$domain=example.com|example.org|example.io` отключно для `example.com` правилом `/some$domain=example.com,badfilter` +* `/some$domain=example.com|example.org|example.io` отключено для `example.com` и `example.org` правилом `/some$domain=example.com|example.org,badfilter` +* `/some$domain=example.com|example.org` и `/some$domain=example.io` полностью отключены правилом `/some$domain=example.com|example.org|example.io,badfilter` +* `/some$domain=example.com|example.org|example.io` полностью отключено правилом `/some$domain=example.*,badfilter` +* `/some$domain=example.*` отключено для `example.com` и `example.org` правилом `/some$domain=example.com|example.org,badfilter` +* `/some$domain=example.com|example.org|example.io` НЕ отключено для `example.com` правилом `/some$domain=example.com|~example.org,badfilter`, поскольку в значении модификатора `domain` содержится отрицание домена ##### **`empty`** From a8407c9849772bb7ecb727b4a64ce1ceeccd8a2f Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Fri, 2 Jul 2021 17:24:49 +0300 Subject: [PATCH 7/9] more about $domain --- 01.general/02.how-to-create-your-own-ad-filters/docs.en.md | 5 ++++- 01.general/02.how-to-create-your-own-ad-filters/docs.ru.md | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index 9c9eb9d4..18625d72 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -343,7 +343,9 @@ In some cases the `$domain` modifier can match not only the referer domain, but When all these conditions are met, the `domain` modifier will match both the referer doman **and** the target domain. ->If some of the conditions above aren't met but the rule contains modifiers `cookie` or `csp`, the target domain will still be matched. +If some of the conditions above aren't met but the rule contains modifiers `cookie` or `csp`, the target domain will still be matched. + +If the referer matches a rule with `domain` that explicitly excludes the referer domain, then the rule won't be applied even if the target domain also matches the rule. This affects rules with `cookie` and `csp` modifiers, too. **Examples:** @@ -357,6 +359,7 @@ In the following examples it's implied that requests are sent from `http://examp * `||*page$domain=targetdomain.com` will not be matched, as the pattern `||*page` matches specific domains. * `||*page$domain=targetdomain.com,cookie` will be matched despite the pattern `||*page` matches specific domains because it contains `$cookie` modifier. * `/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 referer domain is explicitly excluded. diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md index fe74e250..c3d77a4e 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.ru.md @@ -345,7 +345,9 @@ pattern = "/" regexp "/" Если все условия выполнены, модификатор `domain` будет соответствовать как рефереру, так и целевому домену. ->Если какие-либо из условий выше не выполнены, но правило содержит модификатор `cookie` или `csp`, модификатор `domain` всё равно будет соответствовать целевому домену. +Если какие-либо из условий выше не выполнены, но правило содержит модификатор `cookie` или `csp`, модификатор `domain` всё равно будет соответствовать целевому домену. + +Если реферер соответствует правилу с `domain`, которое явно исключает домен реферера, то правило не сработает, даже если целевой домен тоже ему соответствует. Это также касается правил с модификаторами `cookie` и `csp`. **Примеры:** @@ -359,6 +361,7 @@ pattern = "/" regexp "/" * `||*page$domain=targetdomain.com` не сработает, поскольку паттерн `||*page` указывает на конкретные домены. * `||*page$domain=targetdomain.com,cookie` сработает несмотря на то, что паттерн `||*page` указывает на кокретные домены, поскольку правило содержит модификатор `$cookie`. * `/banner\d+/$domain=targetdomain.com` не сработает, поскольку правило содержит регулярное выражение. +* `page$domain=targetdomain.com|~example.org` не сработает, так как домен реферера явно исключён. From 2e82661968a55c009541b212cc0243be816e7ef5 Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Fri, 2 Jul 2021 17:48:38 +0300 Subject: [PATCH 8/9] referer -> referrer --- .../02.how-to-create-your-own-ad-filters/docs.en.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index 18625d72..305f235e 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -335,31 +335,31 @@ 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 referer domain, but also the target domain. This happens when all of the following is true: +In some cases the `$domain` modifier can match not only the referrer domain, but also the target domain. This happens when all of the following is true: 1) The request has `document` type 2) The rule's pattern doesn't match any particular domain(s) 3) The rule's pattern doesn't contain regular expressions -When all these conditions are met, the `domain` modifier will match both the referer doman **and** the target domain. +When all these conditions are met, the `domain` modifier will match both the referrer doman **and** the target domain. If some of the conditions above aren't met but the rule contains modifiers `cookie` or `csp`, the target domain will still be matched. -If the referer matches a rule with `domain` that explicitly excludes the referer domain, then the rule won't be applied even if the target domain also matches the rule. This affects rules with `cookie` and `csp` modifiers, too. +If the referrer matches a rule with `domain` that explicitly excludes the referrer domain, then the rule won't be applied even if the target domain also matches the rule. This affects rules with `cookie` and `csp` modifiers, too. **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`. -In the following examples it's implied that requests are sent from `http://example.org/page`(the referer) and the target URL is `http://targetdomain.com/page`. +In the following examples it's 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 referer domain. +* `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 but satisfies all requirements mentioned above. * `||*page$domain=targetdomain.com` will not be matched, as the pattern `||*page` matches specific domains. * `||*page$domain=targetdomain.com,cookie` will be matched despite the pattern `||*page` matches specific domains because it contains `$cookie` modifier. * `/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 referer domain is explicitly excluded. +* `page$domain=targetdomain.com|~example.org` will not be matched because the referrer domain is explicitly excluded. From fbdb522825c02fc972caef2a7e2d0f8710a8c811 Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Fri, 2 Jul 2021 18:00:32 +0300 Subject: [PATCH 9/9] AG for Safari notice (en) --- 01.general/02.how-to-create-your-own-ad-filters/docs.en.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md index bbb77494..3df9734f 100644 --- a/01.general/02.how-to-create-your-own-ad-filters/docs.en.md +++ b/01.general/02.how-to-create-your-own-ad-filters/docs.en.md @@ -367,6 +367,9 @@ In the following examples it's implied that requests are sent from `http://examp * `/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. +> **Important!** Safari doesn't support the simultaneous use of allowed and disallowed domains, so rules like `||baddomain.com^$domain=example.org|~foo.example.org` will not work in AdGuard for Safari. + + ##### **`third-party`**