Install
Works with Drupal: ^11.2 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
One new capability, for a kind of traffic no rule could describe before.
## Capping facet crawling
Bots walk a search or listing page through every combination of facets —
`?f[0]=type:article&f[1]=tag:a&f[2]=tag:b&f[3]=year:2026` — and each combination
is an uncacheable faceted search. People rarely apply more than two or three.
Nothing could express a cap on that until now. `query.f` resolves to nothing for
a list, PHP keeps only the last of `f=a&f=b`, and a regex over the query string
misses sparse keys, repeated names and interleaving.
A **Request / URL** rule can now match on:
- **`query_count.f`** — how many values arrived for `f`, counted from the raw
query string, so `f[0]=`, `f[]=`, sparse or named keys, encoded brackets and a
repeated `f=` all count the same. A bot cannot get under the cap by changing
how it writes the URL.
- **`query_count`** — how many query parameters arrived in total.
A parameter that is absent counts 0.
The rule to write: `path` starts with `/search` **and** `query_count.f` greater
than `3`. Drupal's Search API uses `f`; use your own parameter name if it
differs.
**Prefer a challenge to a block here.** A block also bans the address, so a real
person who genuinely applied four facets is shut out for the ban period. A
challenge lets them through by solving it. It is also worth pairing with a rate
limit on the search path, for crawlers that stay under the cap but request
thousands of combinations anyway.
Needs `kanopi/firewall` 2.36.0 or later. On an older release the variable is not
offered at all, rather than offered and quietly matching nothing.
## Compatibility
No configuration changes, and no rule needs re-saving. Requires
`kanopi/firewall` ^2.35.1 as before; 2.36.0 or later to use the new variable.
1.x needs PHP 8.1+ and Drupal ^10.6 || ^11; 2.x needs PHP 8.3+ and Drupal
^11.2 || ^12.
Verified against kanopi/firewall 2.36.0, Drupal core 11.4.8,
matomo/device-detector 6.5.2 and twig 3.30.0.
## Tests
814 unit and kernel tests and 268 functional, on both branches.