Skip to content

Commit

Permalink
improve $header modifier description
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka authored Aug 9, 2024
2 parents e95307c + 2340c5f commit 77a9659
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions docs/general/ad-filtering/create-own-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,20 +274,19 @@ Basically, they just limit the scope of rule application.
| [$app](#app-modifier) |||||||
| [$denyallow](#denyallow-modifier) |||||||
| [$domain](#domain-modifier) ||||[*](#domain-modifier-limitations) |[*](#domain-modifier-limitations) ||
| [$header](#header-modifier) || | ||||
| [$header](#header-modifier) || 🧩 [**](#header-modifier-limitations) | 🧩 [**](#header-modifier-limitations) ||||
| [$important](#important-modifier) |||||||
| [$match-case](#match-case-modifier) |||||||
| [$method](#method-modifier) |||||||
| [$popup](#popup-modifier) |* |||* |* ||
| [$popup](#popup-modifier) |[***](#popup-modifier-limitations) |||[***](#popup-modifier-limitations) |[***](#popup-modifier-limitations) ||
| [$third-party](#third-party-modifier) |||||||
| [$to](#to-modifier) |||||||

:::note

- ✅ — fully supported
- ✅ * — supported, but reliability may vary or limitations may occur; check the modifier description for more details
<!-- - 🧩 — may already be implemented in nightly or beta versions but is not yet supported in release versions -->
- ⏳ — feature that has been implemented or is planned to be implemented but is not yet available in any product
- 🧩 — may already be implemented in nightly or beta versions but is not yet supported in release versions
- ❌ — not supported

:::
Expand Down Expand Up @@ -477,7 +476,7 @@ h_value = string / regexp

where:

- **`h_name`** — required, an HTTP header name. It is matched case-insesitively.
- **`h_name`** — required, an HTTP header name. It is matched case-insensitively.
- **`h_value`** — optional, an HTTP header value matching expression, it may be one of the following:
- **`string`** — a sequence of characters. It is matched against the header value lexicographically;
- **`regexp`** — a regular expression, starts and ends with `/`. The pattern works the same way as in the basic URL rules, but the characters `/`, `$` and `,` must be escaped with `\`.
Expand All @@ -491,9 +490,22 @@ The modifier part, `":" h_value`, may be omitted. In that case, the modifier mat
- `@@||example.com^$header=set-cookie:/foo\, bar\$/` unblocks requests whose responses have the `Set-Cookie` header with value matching the `foo, bar$` regular expression.
- `@@||example.com^$header=set-cookie` unblocks requests whose responses have a `Set-Cookie` header with any value.

##### `$header` modifier limitations {#header-modifier-limitations}

:::caution Restrictions

1. The `$header` modifier can be matched only when headers are received.
So if the request is blocked or redirected at an earlier stage, the modifier cannot be applied.
1. In Adguard Browser Extension, the `$header` modifier is only compatible with
[`$csp`](#csp-modifier), [`$removeheader`](#removeheader-modifier), [`$important`](#important-modifier),
and [`$badfilter`](#badfilter-modifier).

:::

:::info Compatibility

Rules with the `$header` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs] v1.11 or later.
Rules with the `$header` modifier are supported by AdGuard for Windows, AdGuard for Mac, and AdGuard for Android
with [CoreLibs] v1.11 or later, and AdGuard Browser Extension with [TSUrlFilter] v3.0.0 or later.

:::

Expand Down Expand Up @@ -565,16 +577,24 @@ AdGuard will try to close the browser tab with any address that matches a blocki

- `||domain.com^$popup` — if you try to go to `http://domain.com/` from any page in the browser, a new tab in which specified site has to be opened will be closed by this rule.

:::info Compatibility
##### `$popup` modifier limitations {#popup-modifier-limitations}

:::caution Limitations

- `$popup` modifier works best in AdGuard Browser Extension.
- In AdGuard for Safari and iOS, `$popup` rules simply block the page right away.
- In AdGuard for Windows, Mac, and Android, `$popup` modifier may not detect a popup in some cases and it will not be blocked.
`$popup` modifier applies the `document` content type with a special flag which is passed to a blocking page.
1. The `$popup` modifier works best in AdGuard Browser Extension.
1. In AdGuard for iOS and AdGuard for Safari, `$popup` rules simply block the page right away.
1. In AdGuard for Windows, AdGuard for Mac, and AdGuard for Android, the `$popup` modifier may not detect a popup
in some cases and it will not be blocked.
The `$popup` modifier applies the `document` content type with a special flag which is passed to a blocking page.
Blocking page itself can do some checks and close the window if it is really a popup.
Otherwise, page should be loaded.
It can be combined with other request type modifiers, such as `$third-party` and `$important`.
- Rules with `$popup` modifier are not supported by AdGuard Content Blocker.

:::

:::info Compatibility

Rules with the `$popup` modifier are not supported by AdGuard Content Blocker.

:::

Expand Down

0 comments on commit 77a9659

Please sign in to comment.