How to Use Botstopper on Hypernode

Bot traffic has changed. Some bots still identify themselves with clear user agents, but many scrapers now use large sets of user agents or pretend to be a normal Chrome browser. That makes simple user-agent blocking less reliable.

Botstopper gives you control over this traffic before it reaches Magento, Shopware, or another application. It checks incoming requests and decides whether they should be allowed, blocked, or challenged. Botstopper is the commercial derivative of the open source project Anubis.

Use Botstopper when bots cause high load, scrape content, crawl expensive layered navigation URLs, or ignore your robots.txt file. Botstopper also lets each merchant choose how strict they want to be with AI crawlers and AI clients.

Tip

For more background on bot traffic and Magento performance, see How to Fix Performance Issues Caused by Bots and Crawlers.

Enable Botstopper

Botstopper is disabled by default on a Hypernode. Enable it with:

hypernode-systemctl settings botstopper_enabled True

Disable it again with:

hypernode-systemctl settings botstopper_enabled False

Configure Botstopper Per Vhost

Botstopper is enabled per vhost by default. This means that when you enable Botstopper on Hypernode level, Botstopper becomes active for all managed vhosts unless you disabled it for a specific vhost. See Hypernode Managed Vhosts for more information about vhost configuration.

Disable Botstopper for one vhost with:

hypernode-manage-vhosts example.com --disable-botstopper

Enable it again for that vhost with:

hypernode-manage-vhosts example.com --botstopper

Tip

Keep in mind that botstopper is only active for HTTPS domains, because it uses the Secure flag for its cookies, which requires TLS.

Choose an AI Policy

Botstopper has three AI policies. The default policy is aggressive.

hypernode-systemctl settings botstopper_ai_policy aggressive
hypernode-systemctl settings botstopper_ai_policy moderate
hypernode-systemctl settings botstopper_ai_policy permissive

Policy

Behavior

aggressive

Blocks AI training crawlers, AI search crawlers, and AI clients as much as possible.

moderate

Blocks AI training crawlers and unknown AI bots. Allows documented AI search bots and user-triggered AI clients.

permissive

Allows documented AI bots. Blocks unknown AI-style bots.

See How to Choose a Botstopper AI Policy for a detailed comparison of what each policy blocks and how verified AI bots are treated.

Some AI crawlers also require robots.txt rules before they respect your opt-out. Botstopper blocks requests at the webserver layer, but robots.txt is still useful for crawlers that require policy signals there. See the Magento 1 robots.txt or Magento 2 robots.txt articles if you need to configure one.

Preserve UTM Attribution After a Challenge

When a visitor passes a Botstopper challenge, the browser lands on your shop with the challenge page as the technical referrer. This breaks referrer attribution in client-side analytics tools such as Plausible or GA4. Botstopper restores the original Referer header on the request it forwards to your shop, but tools that read document.referrer or UTM tags cannot be corrected that way.

To keep attribution working for those tools, Botstopper can append the original external referer host to the post-challenge redirect URL as utm_source and utm_medium query parameters. For example, a visitor coming from https://www.google.com/search?q=shoes lands on https://example.com/?utm_source=www.google.com&utm_medium=referral after passing the challenge.

This behavior is enabled by default. Disable it with:

hypernode-systemctl settings botstopper_utm_referer_enabled False

Enable it again with:

hypernode-systemctl settings botstopper_utm_referer_enabled True

Botstopper only adds these parameters when the original referer is an external domain and the redirect URL does not already contain UTM parameters.

How Botstopper Handles Requests

Botstopper evaluates policy rules from top to bottom. A rule can allow, deny, challenge, or weigh a request.

Action

What happens

ALLOW

The request is sent to your shop immediately.

DENY

The request is blocked with HTTP 403.

CHALLENGE

The visitor receives a browser challenge.

WEIGH

Suspicion points are added or removed. Evaluation continues.

ALLOW, DENY, and CHALLENGE stop evaluation immediately. The first matching rule wins.

WEIGH does not stop evaluation. Multiple WEIGH rules can match the same request. After all rules are checked, Botstopper uses the final weight to decide whether the request should be allowed or challenged.

Challenge responses use HTTP 200. This is intentional. Many aggressive scraper bots stop retrying once they receive a 200 response.

Standard Hypernode Policies

Hypernode ships Botstopper with a standard policy that keeps important services working and blocks common abusive traffic.

The standard policy does the following:

  1. Allows Hypernode platform services, payment providers, monitoring tools, and common e-commerce integrations.

  2. Allows IP addresses on the Hypernode WAF allowlist.

  3. Allows requests that your Hypernode, or any other node in your cluster, sends to itself, for example an extension that fetches WordPress content from your own domain, or a cache warmer requesting storefront pages.

  4. Runs your custom pre-policy from /data/web/botstopper/pre.policy.yml.

  5. Denies sensitive Magento media paths, such as /media/customer/, /media/import/, and /media/downloadable/.

  6. Allows storefront assets, such as /static/, normal /media/ files, etc.

  7. Denies or weighs known bad bots, headless browsers, abusive cloud ranges, and suspicious HTTP clients.

  8. Applies the configured AI policy.

  9. Allows known good search engine crawlers when they are verified by IP ranges or reverse DNS.

  10. Allows common public files, such as robots.txt, sitemap.xml, favicon.ico, and .well-known paths.

  11. Adds suspicion weight for some high-risk countries, networks, and browser-like user agents.

  12. Runs your custom post-policy from /data/web/botstopper/post.policy.yml.

  13. Uses the final suspicion weight to allow or challenge the request.

The WAF allowlist is shared with the Hypernode firewall allowlist. Botstopper allows these IPs before your custom pre.policy.yml and before the standard deny and challenge rules.

Add a trusted IP to the WAF allowlist with:

hypernode-systemctl whitelist add waf 1.2.3.4 --description "Office IP"

View the WAF allowlist with:

hypernode-systemctl whitelist get --type waf

See How to allowlist FTP, WAF and database for more details.

The order matters. For example, a broad DENY rule in pre.policy.yml can block a good crawler before the standard verified crawler allow rules are reached.

Write Custom Policies

You can add your own rules in these files:

File

When it runs

Use it for

/data/web/botstopper/pre.policy.yml

Before most standard deny and challenge rules

Allowing trusted traffic or blocking very specific traffic early.

/data/web/botstopper/post.policy.yml

After standard rules, before final weight thresholds

Adding suspicion weight or handling fallback cases.

Both files contain a YAML list of policy rules. An empty file looks like this:

[]

Edit the files as the app user. For example:

sensible-editor /data/web/botstopper/pre.policy.yml

After changing a policy file, restart Botstopper:

hypernode-servicectl restart techaro-botstopper@default

Policy Conditions

A policy rule can match on request details, such as the client IP, user agent, path, or headers.

Common fields are:

Field

Checks

remote_addresses

Client IP address against CIDR ranges.

user_agent_regex

The User-Agent header against a regular expression.

path_regex

The request path against a regular expression.

headers_regex

Request headers against regular expressions.

expression

A custom expression for advanced matching.

When a rule has multiple conditions, all conditions must match. This is useful for trusted allow rules. For example, you can allow a monitoring tool only when both its user agent and source IP match.

Examples

Allow a trusted monitoring service:

- name: allow-my-monitor
  action: ALLOW
  user_agent_regex: MyMonitor
  remote_addresses:
    - 203.0.113.10/32

Block a specific bot:

- name: block-bad-bot
  action: DENY
  user_agent_regex: BadBot

Challenge traffic to an expensive search page:

- name: challenge-suspicious-search
  action: CHALLENGE
  path_regex: ^/catalogsearch/result/.*

Add suspicion weight for bots crawling layered navigation URLs:

- name: weigh-layered-navigation-bots
  action: WEIGH
  expression:
    all:
      - userAgent.matches("(?i:bot|crawler|spider)")
      - '"color" in query || "size" in query || "brand" in query'
  weight:
    adjust: 20

Protect a trusted integration from a broader custom rule:

- name: allow-partner-feed
  action: ALLOW
  path_regex: ^/partner/feed/.*
  user_agent_regex: PartnerFeedClient
  remote_addresses:
    - 198.51.100.0/24

Allow JSON API requests, using CEL expressions:

- name: allow-api-requests
  action: ALLOW
  expression:
    all:
      - '"Accept" in headers'
      - 'headers["Accept"] == "application/json"'
      - 'path.startsWith("/api/")'

Add suspicion weight for traffic from a specific country:

- name: weigh-countries-with-high-bot-traffic
  action: WEIGH
  expression:
    all:
      - '"X-Country-Code" in headers'
      - 'headers["X-Country-Code"] in ["BY", "RU"]'
  weigh:
    adjust: 10

You usually do not need allow rules for API or webhook traffic. Botstopper allows traffic by default. Use an ALLOW rule when you already have, or plan to add, a broader custom rule that could otherwise challenge or block this trusted traffic.

Only Challenge Visitors Under High Load

You can keep Botstopper enabled at all times, but only show challenges to visitors when your Hypernode is actually under pressure. Botstopper keeps running in the background, and when a bot attack drives up the load, the protection kicks in automatically. When the load drops again, visitors are no longer challenged.

To do this, use the system load average in a WEIGH rule.

What the Load Average Is

On Linux, every process has to wait its turn to run on a CPU core. The load average is the number of processes that are running or waiting to run. Botstopper can use this value in expressions:

Variable

Meaning

load_1m

The average load over the last minute.

load_5m

The average load over the last 5 minutes.

load_15m

The average load over the last 15 minutes.

The load average does not take the number of CPU cores into account. A load of 4.0 means that a 4-core Hypernode is fully busy, while an 8-core Hypernode is only half busy. Check the number of cores on your Hypernode with:

nproc

Choose a Threshold

To have Botstopper kick in when the CPU is more than 75% busy, multiply the number of cores by 0.75:

CPU cores

Load threshold (75%)

2

1.5

4

3.0

8

6.0

16

12.0

Always write the threshold as a decimal number, for example 3.0 instead of 3. Otherwise the comparison in the expression does not work.

Add the Rule

Add the following rule to /data/web/botstopper/post.policy.yml. This example is for a Hypernode with 4 CPU cores:

- name: skip-challenges-under-low-load
  action: WEIGH
  expression: load_1m < 3.0
  weight:
    adjust: -100

As long as the load stays below 3.0, this rule removes a large amount of suspicion weight from every request. The final weight then stays below the challenge threshold, so visitors are not challenged. As soon as the load reaches 3.0 or higher, the rule no longer matches and Botstopper challenges suspicious requests as usual.

Restart Botstopper to apply the change:

hypernode-servicectl restart techaro-botstopper@default

Keep the following in mind:

  • This rule only changes the challenges that are based on suspicion weight. Rules that DENY or CHALLENGE a request directly, such as the rules for known bad bots, still apply at any load.

  • load_1m reacts quickly, so Botstopper turns on soon after an attack starts. It also turns off quickly, which can make it switch on and off often during an attack that comes in waves. Use load_5m if you prefer a more stable setting.

  • The load average is a symptom, not a cause. A shop can also become slow because of a slow database or external service while the load stays low. In that case, this rule does not activate the challenges.

Logging

The botstopper service logs to /var/log/botstopper/botstopper.log. The log file consists JSON Lines, meaning that each line in the log file is a JSON-parseable line.

To check the Botstopper logs in a human-readable manner, you can use the hypernode-parse-botstopper-log command. Read more about it in How to View Botstopper Logs on Hypernode.

Cookies

In order to verify visitors, Botstopper uses cookies to track whether a visitor has passed a challenge. The following cookies are used:

Cookie Name

Purpose

hnbotstopper-auth-[hash]

Used for authenticated sessions after a successful challenge.

hnbotstopper-cookie-verification-[hash]

Temporary cookie to check whether the browser has cookies enabled.

Cookies sent by Botstopper have the following flags set:

Flag

Purpose

Secure

Ensures cookies are only sent over HTTPS connections.

HttpOnly

Prevents client-side scripts from accessing the cookies.

SameSite=None

Cross-domain requests will keep working, safe option with the Secure flag.

Safe Policy Changes

Use specific rules whenever possible. Broad user-agent rules can block legitimate crawlers or integrations.

Prefer WEIGH when you are not fully sure traffic should be blocked. A WEIGH rule lets Botstopper combine multiple signals before it challenges the request.

Use ALLOW with both a user agent and IP range for trusted services when possible. User agents can be spoofed, IP ranges are harder to fake.

Use the WAF allowlist for trusted source IPs that should always bypass Botstopper checks. This is often better than maintaining your own IP allow rule in pre.policy.yml.

Keep custom DENY rules narrow. A broad DENY rule in pre.policy.yml can override the standard Hypernode allow rules that run later.

Do not add allow rules for every API endpoint or webhook. Add them when a specific Botstopper rule would otherwise match that traffic.

Anubis Documentation

Because Botstopper is the commercial derivative of Anubis, the Anubis documentation is a useful reference when you want to understand the underlying concepts or write advanced custom policies: