CONTENTS OF THIS FILE
---------------------

 * Introduction
 * Requirements
 * Installation
 * Configuration
 * How It Works
 * Maintainers


INTRODUCTION
------------

BotBuster provides lightweight DDoS protection for Drupal sites by requiring
browsers to pass a JavaScript challenge before accessing protected paths.

It works as an HTTP middleware that intercepts requests to configured paths and
serves a browser verification challenge page. Only clients that can execute
JavaScript and generate a valid token are allowed through. This effectively
blocks simple bots, scrapers, and automated tools that do not run JavaScript.

 * For a full description of the module, visit the project page:
   https://www.drupal.org/project/botbuster

 * To submit bug reports and feature suggestions, or track changes:
   https://www.drupal.org/project/issues/botbuster


REQUIREMENTS
------------

This module requires no modules outside of Drupal core.

A private file system path must be configured in settings.php:

  $settings['file_private_path'] = 'sites/default/files/private';


INSTALLATION
------------

 * Install as you would normally install a contributed Drupal module.
   Visit https://www.drupal.org/node/1897420 for further information.


CONFIGURATION
-------------

 1. Navigate to Administration > Configuration > System > BotBuster.
 2. Enable DDoS protection.
 3. Enter the paths you want to protect, one per line. Wildcards (*) are
    supported. Examples:
      /search
      /search/*
      /catalog/*
      *facet*
 4. Configure the token lifetime (how long a verified browser stays valid).
 5. Customize the challenge page text (title, heading, description, etc.).
 6. Save configuration. The challenge page and protected paths files are
    generated automatically.
 7. If your site is behind a CDN/reverse proxy, ensure the BotBuster token
    cookie is forwarded to origin. By default the cookie name is
    <code>botbuster_token</code> (configurable in the module form).


HOW IT WORKS
------------

BotBuster operates at the HTTP middleware level for minimal performance impact:

 1. When a request arrives for a protected path, the middleware checks for a
    valid botbuster_token cookie.
 2. If no valid token exists, a challenge page is served instead of the
    requested page. The challenge page runs JavaScript that generates a browser
    fingerprint token and sets it as a cookie.
 3. After successful verification, the browser is redirected back to the
    originally requested page. Subsequent requests include the token cookie
    and pass through without challenge.

The challenge page and protected paths configuration are pre-generated as
static files in the private file system. This means the middleware does not
need to bootstrap Drupal services on every request, keeping overhead minimal.

CDN / REVERSE PROXY SETUPS
--------------------------

BotBuster requires the token cookie to reach Drupal origin on protected-path
requests. If a CDN/reverse proxy strips unknown cookies, users can be trapped
in a repeated challenge loop.

Default cookie name: <code>botbuster_token</code>

If your edge only forwards allowlisted patterns, either:
 - allowlist <code>botbuster_token</code>, or
 - configure BotBuster to use a cookie name that matches your allowlist.

Common examples:

 - Fastly:
   update VCL to preserve the BotBuster cookie in <code>req.http.Cookie</code>
   when forwarding requests to origin.

 - Upsun / Platform.sh:
   add the BotBuster cookie to the route cookie allowlist in
   <code>.platform/routes.yaml</code>.

 - Varnish:
   in <code>vcl_recv</code>, keep/pass the BotBuster cookie instead of dropping
   it for matching requests.

 - Cloudflare:
   verify cache/rules configuration does not strip the BotBuster cookie before
   forwarding to origin.


MAINTAINERS
-----------

 * Valentin Zsigmond (vzsigmond) - https://www.drupal.org/u/vzsigmond
