Refine bot detection logic in layered navigation best-pratice - #524
Merged
Merged
Conversation
This updates the layered navigation check to match against $args rather than $request_uri.
Contributor
|
Acceptance server is available at https://docs-ephcac5vj.hypernode.io. |
poespas
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes layered navigation matching from
$request_urito$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 likecolor,size,mode, anddirmore 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.