Loading

Detecting and Mitigating Product Scraping Bot Traffic With eCDN Rules in B2C Commerce

Udgivelsesdato: Oct 2, 2026
Beskrivelse

What Product Scraping Looks Like

Product scraping is a technique that walks through a storefront's catalog by abusing search refinement parameters. Because each request carries a unique query string, almost none of them hit the page cache. The result is sustained load on search controllers and eviction of genuine category pages from cache. B2C Commerce is designed to process all valid refinement combinations, so each customer needs eCDN-layer configuration tailored to their own catalog shape to prevent that flexibility from being abused for scraping. Unlike traffic coming from legitimate AI crawlers and shopping agents (see Detecting and Managing AI Crawler and Shopping Agent Traffic With eCDN Rules in B2C Commerce), this traffic is usually malicious.

Example scenario:

A mid-size fashion retailer on B2C Commerce notices its category pages are being evicted from cache far more often than usual during otherwise-quiet overnight hours. Their eCDN logs show a high volume of requests to the same category, with unusually long refinement values and steadily increasing pagination offsets. This combination of over-stuffed refinements and mechanical pagination is exactly the pattern the rules below are built to catch.

 

Example scenario: Deciding When to Escalate

The same retailer runs Rules 1–7 in Log mode for two weeks. Rule 1 (value stuffing) never fires on sessions that reach checkout — only on sessions with no add-to-cart events and a single-digit page-view count. That consistency is the signal to escalate Rule 1 to Managed Challenge first, before touching the broader Rule 7 (query length), which still occasionally fires on shoppers who apply many filters at once.

 

Recognizing the Patterns

Product scraping doesn't have a single signature. The table below describes, at a conceptual level, the categories of misuse that the detection rules in this article are designed to catch.

PatternWhat the Bot Does
Value stuffingCombines an unusually large number of values into a single refinement parameter
Dimension stackingApplies more refinement dimensions at once than a real storefront UI would generate
Price sweepingWalks a price range in small increments across many requests
Attribute range sweepingWalks a numeric attribute range the same way
Pagination walkingMarches through a result set using abnormally large page sizes or offsets
Sort cyclingRe-requests the same result set under every available sort order
Cache bustingAdds parameters the application doesn't recognize, purely to defeat caching
SEO path refinementsEncodes an unusually large number of refinements directly into the URL path instead of the query string
 

Four of the patterns above don't rely on an obvious single character or symbol — this is why the recommendation below is to deploy the full set of rules together, not any one rule in isolation.

 

Delimiter and Encoding

B2C Commerce's refinement parameters use a single, fixed multi-value delimiter, and the platform normalizes encoding before evaluating it — including handling of case and repeated encoding. Build detection expressions with decoding and normalization in mind rather than assuming a bot will send parameters in exactly the form a human-driven UI would.

Løsning

Before You Begin

Every rule in this article uses only fields available in a standard eCDN setup: http.request.uri.*, cf.client.bot, cf.verified_bot_category, and cf.waf.score. In terms of limits, there are 500 custom rules per zone and 4096 characters per rule expression. Regex uses RE2 (a linear-time regular expression engine) — no lookahead, lookbehind, or backreferences. The only platform-level length guard is the container's header limit, roughly 24 KB. Everything below that reaches the application, so the thresholds set here are the real ceiling. 

eCDN rules can be created in two ways using the eCDN Rule Expression Fields:

  1. Business Manager: Create a Custom Firewall Rule for an eCDN Zone & Create a Rate Limiting Rule for an eCDN Zone
  2. CDN Zones API: eCDN Custom Rules & eCDN Rate Limiting Rules

Pay attention to the rule order as they execute in a top-to-bottom order. Rules can be created and ordered in the eCDN zone's custom rules editor if using Business Manager or set when using the CDN Zones API. Therefore, ensure that the allow-rule in Step 1 is the first rule listed.

 

Step 1: Allow Verified Crawlers First

Rule order matters. Place an allow-rule for verified bots above every detection rule, or legitimate crawlers like Googlebot get challenged and SEO is damaged. Use the platform's verified-bot signal, with an action that skips the custom detection rules below or known bots like Googlebot gets challenged and SEO is damaged.

cf.client.bot

Action: skip_custom_rules

This rule checks a single built-in signal — "is this request from a bot the platform has already verified as legitimate (e.g. Googlebot)?" If yes, every rule below is skipped entirely, so verified crawlers are never challenged or blocked by the scraping rules that follow.

 

Step 2: Add the Detection Rules in Log Mode

Set every rule below to Log. Logging has no effect on shoppers, and real traffic data is needed before choosing thresholds. Adjust the path match to suit the storefront.


Rule 1: Value stuffing

lower(url_decode(http.request.uri.query)) matches "prefv[0-9]+=[^&]*(\|[^&]*){5,}"

This rule looks at the full query string, decodes it, and lowercases it so capitalization and encoding tricks can't hide anything. It then checks every prefv (refinement value) parameter and flags one that contains six or more values joined by the pipe (|) character — far more than a shopper clicking checkboxes would ever generate in one request. Matches a refinement value containing six or more OR-joined values. This is the highest-value rule, because the platform applies no cap of its own here.


Rule 2: Dimension stacking

http.request.uri.query matches "prefn([4-9]|[0-9]{2,})="

Each prefn parameter represents one refinement dimension (e.g. color, size, brand) applied to the search. This rule flags a request that uses a 4th through 9th dimension, or any two-digit dimension index (prefn10 and up). Matches a fourth or higher refinement dimension. The two-digit branch matters: one platform parser accepts unbounded indices, so prefn10 and beyond are valid input. No storefront UI emits them, which makes a two-digit index on its own a strong bot signal.


Rule 3: Range sweeping

http.request.uri.query matches "prefm(in|ax)[0-9]+=" or
(http.request.uri.query contains "pmin=" and
http.request.uri.query contains "pmax=" and
http.request.uri.query matches "prefn[0-9]+=")

This rule has two independent triggers. The first half flags any use of prefminN or prefmaxN — the per-attribute numeric range parameters (e.g. sweeping a weight or size range). The second half flags a request that combines a price floor (pmin) and ceiling (pmax) with a numbered refinement dimension — i.e. a price sweep layered on top of another filter. Covers both price bands and per-attribute numeric ranges. prefmin/prefmax are easy to overlook — they are a separate sweepable surface from pmin/pmax.


Rule 4: Pagination walking

http.request.uri.query matches "[?&](sz|count)=[0-9]{4,}" or
http.request.uri.query matches "[?&]start=[0-9]{5,}"

This rule flags abnormally large page-size or offset values — a sz or count parameter with four or more digits (thousands of items per page), or a start offset with five or more digits (paging tens of thousands of items deep). sz has no bounds check on the storefront path, and the Salesforce Commerce API (SCAPI) offset has no ceiling. SCAPI count is capped at 200 and rejected above that, so a four-digit count is always malformed.


Rule 5: SEO path refinements

http.request.uri.path matches "([^/]*_){5,}"

When a storefront has SEO-friendly URLs enabled, refinements are encoded directly into the URL path (segments separated by _) instead of the query string. This rule flags a path with five or more underscore-delimited segments — the path-based equivalent of value stuffing. When refinements are SEO-enabled they appear in the URL path, not the query string, and every query-string rule above is blind to them. The platform rewrites them back into prefn/prefv before dispatch, so the origin cost is identical. The default value delimiter is _ and the segment delimiter is -, both configurable per site in Business Manager — confirm site settings before trusting this rule, since category slugs containing underscores will cause false positives.


Rule 6: Salesforce Commerce API (SCAPI) refinements

url_decode(http.request.uri.query) matches "refine_[0-9]+=[^&]*(\|[^&]*){5,}" or
http.request.uri.query matches "refine_([5-9]|[0-9]{2,})="

SCAPI represents refinements differently — as numbered refine_N parameters. This rule mirrors Rules 1 and 2 for that API: the first half flags value stuffing inside a refine_ parameter (six or more pipe-joined values), the second half flags a 5th or higher refinement dimension. SCAPI uses numbered refine_N parameters and the same pipe delimiter, delegating to the identical search engine. It also accepts a (min..max) range form, so \.\. inside a refine_ value is worth logging too. Important: SCAPI traffic reaches a different hostname from the storefront — confirm it passes through the eCDN zone before assuming these rules apply.


Rule 7: Query length

len(http.request.uri.query) gt 512 and
http.request.uri.path contains "Search-"

This is a catch-all safety net: on any search request, if the full query string is longer than 512 characters, something unusual is happening — regardless of which specific parameter caused it. It won't tell you which pattern above is in play, but it catches combinations the other six rules might individually miss. A blunt but effective catch-all. Tune 512 once traffic has been measured.

 

Rule 8: Volume (rate limiting rule) Catches every pattern above regardless of shape or encoding.

  • Expression: http.request.uri.path contains "Search-UpdateGrid" or http.request.uri.path contains "/sale"
  • Characteristic: IP with NAT support (cf.unique_visitor_id)
  • Period: 60 seconds
  • Requests per period: start high, then tighten
  • Action: Log

Rather than inspecting the shape of any single request, this rule counts requests per visitor over a rolling 60-second window on search and sale paths. A real shopper browsing a catalog won't come close to a high per-minute request count; a scraping bot walking combinations will. Because it counts volume rather than matching a pattern, it catches every scenario above regardless of how the bot encodes its requests.

 

Step 3: Measure

Run the rules in log mode for at least one full week, including a weekend, so weekday and weekend shopper behavior are both represented. From the logs, establish a baseline for real shopper traffic on each signal, and set thresholds just above that baseline. If a rule fires on sessions that go on to add to cart or check out, loosen it — those are real shoppers, not bots. Ideally, rules should only fire during attacks and not catch traffic during non-attack windows. Otherwise, blocks or managed challenges might be issued to legitimate shoppers falling outside of the usual patterns. For example, shoppers who may occasionally apply more than the expected refinements on a category page. Export logs or configure log forwarding to persistent storage before measuring, since eCDN log retention windows are short.

 

Step 4: Escalate

Once thresholds are tuned and the rules are reliably catching bot traffic:

  1. Move the highest-confidence rules — the ones that cannot be produced by a real storefront UI — to Managed Challenge.
  2. Move the broader, less certain rules to Managed Challenge or Block, based on how clean they've been in testing.
  3. Move consistently clean rules to Block, and tighten the rate limit over time.

Do not apply a challenge to API, AJAX, or SLAS login endpoints that cannot render one — a challenge there behaves like a permanent block. This includes all SCAPI traffic.
Note that block, managed_challenge, js_challenge, and skip_custom_rules stop further custom rule evaluation. log does not.

Yderligere ressourcer
Vidensartikelnummer

005460821

 
Indlæser
Salesforce Help | Article