Enhanced Firewall (WAF)
PHP-level firewall that runs before WordPress loads. Auto-detects server type, syncs patterns, and blocks requests in ~1ms.
Last updated Feb 22, 2026
Overview
The Enhanced Firewall (WAF) is a PHP-level firewall that runs before WordPress loads. While the standard firewall inspects requests inside WordPress after the full PHP and WordPress bootstrap, the Enhanced WAF intercepts requests at the earliest possible point in the PHP execution lifecycle.
This means malicious requests are blocked before WordPress core, plugins, themes, or the database are touched. The overhead is approximately 1ms per request, making it one of the fastest ways to protect your site.
Standard vs enhanced firewall
| Feature | Standard firewall | Enhanced firewall (WAF) |
|---|---|---|
| When it runs | After PHP + WordPress fully load | Before any WordPress code executes |
| How it loads | WordPress plugin hook | auto_prepend_file PHP directive |
| Pattern database | WordPress database | Flat PHP files (synced from database) |
| Blocks before WP loads | No | Yes |
| Performance overhead | Part of WordPress request cycle | ~1ms standalone |
| Configuration | Automatic with plugin | One-click install with server auto-detection |
Both firewalls use the same pattern database, matching engine, and input normalization pipeline. The Enhanced WAF simply applies them earlier in the request lifecycle.
Server compatibility
ArmorPro auto-detects your server type during installation and configures the WAF accordingly:
| Server type | Configuration method |
|---|---|
| Apache (mod_php) | .htaccess directive |
| Apache (CGI/FastCGI) | .user.ini directive |
| Nginx | .user.ini directive (or manual php.ini) |
| LiteSpeed | .user.ini directive |
Installation
Installing the Enhanced Firewall takes one click:
- Navigate to ArmorPro → Firewall
- Find the Enhanced Firewall card
- Click Install
ArmorPro then performs the following steps automatically:
- Auto-detects your server type (Apache, Nginx, LiteSpeed)
- Creates the
wp-content/armor-waf/directory - Copies the firewall engine to
armor-waf/firewall.php - Syncs patterns and settings to flat PHP files inside
armor-waf/ - Creates
armor-waf.phpbootstrap file in the WordPress root directory - Configures
auto_prepend_filevia.htaccessor.user.ini
Tip
After installing, click Verify to confirm the WAF is active. ArmorPro checks for the ARMOR_WAF_ACTIVE constant, which is set by the WAF engine on every request it processes.
WAF data files
The Enhanced WAF reads its configuration from flat PHP files instead of the WordPress database. This is what allows it to run before WordPress loads. The following files are maintained in wp-content/armor-waf/:
| File | Contents |
|---|---|
settings.php | Firewall configuration (response code, request length limit, skip logged-in, auto-blacklist threshold) |
patterns.php | All enabled firewall patterns with their categories and matching modes |
whitelist.php | All whitelisted IP addresses |
blacklist.php | All blacklisted IP addresses with expiry dates |
Auto-sync
Whenever you make changes in the WordPress admin that affect the WAF, ArmorPro automatically syncs the updated data to the flat files:
- Enable or disable a firewall pattern →
patterns.phpis updated - Add or remove a custom pattern →
patterns.phpis updated - Add or remove a whitelisted IP →
whitelist.phpis updated - Add or remove a blacklisted IP →
blacklist.phpis updated - Change firewall settings →
settings.phpis updated
This means you manage everything through the normal ArmorPro admin interface. The WAF data files stay in sync automatically.
Management controls
Once installed, the Enhanced Firewall card shows three management buttons:
- Verify — Tests whether the WAF is actively processing requests by checking for the
ARMOR_WAF_ACTIVEconstant. Returns a green confirmation or a warning if the WAF is not loading. - Force Sync — Re-exports all configuration, patterns, whitelist, and blacklist data to the flat PHP files. Use this if you suspect the files are out of date.
- Remove — Uninstalls the WAF completely. Removes the
armor-waf/directory, the bootstrap file, and theauto_prepend_filedirective from.htaccessor.user.ini.
Fail-open design
The Enhanced WAF is designed with a fail-open approach. If the WAF engine encounters any error during execution (missing files, corrupted data, PHP errors), the request is allowed through rather than blocked. This ensures that a WAF issue never takes your entire site offline.
The standard in-WordPress firewall remains active as a backup, so even if the WAF encounters an error, requests are still inspected once WordPress loads.
Manual configuration
If the automatic installation cannot configure auto_prepend_file (for example, on servers where .user.ini is not supported), you can configure it manually.
Add the following to your server's php.ini or PHP-FPM pool configuration:
auto_prepend_file = /path/to/your/wordpress/armor-waf.phpReplace the path with the full absolute path to the armor-waf.php file in your WordPress root directory. After making the change, restart PHP-FPM or your web server for the setting to take effect.
Important
If you change hosting providers or server configuration (for example, migrating from Apache to Nginx), you may need to reinstall the Enhanced Firewall. Use the Remove button first, then Install again to reconfigure for the new environment.