Skip to content

Refine bot detection logic in layered navigation best-pratice - #524

Merged
poespas merged 1 commit into
masterfrom
TimVNL-patch-4
Sep 16, 2026
Merged

poespas merged 1 commit into
masterfrom
TimVNL-patch-4

Conversation

@TimVNL

@TimVNL TimVNL commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This PR changes layered navigation matching from $request_uri to $args, since the rule is intended to inspect query parameters rather than the full URI.

It also adds (^|&) to the regex to match only at real query parameter boundaries. This avoids looser substring matching and makes detection of parameters like color, size, mode, and dir more precise.

More Detailed explanation

This change updates the layered navigation matching logic to use $args instead of $request_uri, since the rule is intended to inspect query parameters rather than the full request URI.

It also introduces query parameter boundaries using (^|&). In Nginx, ~* performs a case-insensitive regex match, and (^|&) ensures the match happens either at the start of the query string or immediately after another parameter
separator.

This makes the rule more precise and reduces the chance of unintended substring matches while keeping the logic focused on real layered navigation parameters such as color, size, mode, and dir.

This updates the layered navigation check to match against $args rather than $request_uri.
@github-actions

Copy link
Copy Markdown
Contributor

@poespas
poespas merged commit 276fa9d into master Sep 16, 2026
6 checks passed
@TimVNL
TimVNL deleted the TimVNL-patch-4 branch September 16, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants