Skip to content

Exponential CMS

The request shield in depth

Install, configure, test, monitor, pause and update exp_request_shield on an Exponential site.

The request shield (exp_request_shield) is a small web application firewall that decides each request before the kernel starts: scanners, floods, stray form posts and requests for system URLs are refused, and the sign-in and the administration's forms ask for a short browser check. It needs Exponential 6.0 and PHP 7.4 to 8.5; APCu is optional. A 6.0.15 installation already has it, because the root composer.json requires it.

Install on an existing site

  1. composer require se7enxweb/exp_request_shield, then ActiveExtensions[]=exp_request_shield in settings/override/site.ini.append.php.
  2. php bin/php/ezpgenerateautoloads.php -e and php bin/php/ezcache.php --clear-all (or ./console exp:velocity deploy --packer).
  3. Give the site its own rules and test them (below) before the next step.
  4. Add the hook to config.php, above the line that loads the HTTP cache's early exit, so cached pages are protected too. config.php-RECOMMENDED has these lines in the section REQUEST SHIELD. Under Velocity, restart it.
if ( is_file( __DIR__ . '/extension/exp_request_shield/bootstrap/hook.php' ) )
    require __DIR__ . '/extension/exp_request_shield/bootstrap/hook.php';

The site's own rules

Until the site has its own file, the extension's default rules apply, and every update replaces them. The first mode switch in Setup > Request shield creates settings/request-shield/request-shield.rules with copies of the three exponential*.rules beside it. In it, include the admin rules for a path or a host name, fix the paths of the store and the log, name every host name of the site, and name a proxy in front with trust, or every visitor seems to come from the proxy.

Check, test, trace

php extension/exp_request_shield/bin/request-shield check settings/request-shield/request-shield.rules
php extension/exp_request_shield/bin/request-shield test  settings/request-shield/request-shield.rules
php extension/exp_request_shield/bin/request-shield trace settings/request-shield/request-shield.rules "GET https://www.example.org/the/path"

check names mistakes by file and line; test decides every expect example next to the rules and must pass after every change; trace shows how one request is decided. Run them as the user the site's PHP runs as.

Monitor or enforce

The rules ship in enforce mode. In monitor mode every decision is logged as it would be taken and nobody is refused: useful for the first days on a site with unusual addresses, or while you look into a complaint. Switch with Enforce and Monitor on the dashboard (policy requestshield/manage) or with set mode in the rule file; every server reads a changed file within seconds. When a real visitor was refused, the log names the rule: add an exception with an expect example that must pass and one that must still be refused.

Pause it

  • Pause on the dashboard, or touch var/request-shield/PAUSED: the shield does nothing, on every server, from the next request.
  • Off, or set mode off in the rules: nothing is decided.
  • define( 'EXP_REQUEST_SHIELD_DISABLED', true ); before the hook line.

Update

Update the extension with composer update se7enxweb/exp_request_shield, never the bundled library on its own. Then run check and test and compare your three copies with the extension's rules. Under Velocity: create PAUSED, update, restart Velocity, remove PAUSED.

Last updated 11/26/2026. Something missing or wrong? Write to info@se7enx.com.