Skip to content

Configure WAF for your site

This guide turns on the Quant Web Application Firewall (WAF) on a proxy rule, in report mode first, then in block mode. It also covers tuning, rate limits and how to test a block.

The WAF inspects requests on proxy rules only, which are the requests that reach an application. Pages served from static content are not inspected, because no application handles them. Turn the WAF on for each proxy rule that sends requests to an application.

On those requests, the WAF applies the OWASP Core Rule Set, which detects attacks such as:

  • SQL injection: database manipulation attempts
  • Cross-site scripting (XSS): malicious script injection
  • Remote file inclusion: attempts to include external files
  • Local file inclusion: attempts to read server files, such as /.env
  • Protocol attacks: HTTP protocol violations

The same panel also has block lists for known bad bots, referers and IP addresses, and rate limits. Each rate limit has its own Mode, separate from WAF mode (see Step 6).

  • A Quant project with a proxy rule that sends requests to your application.
  • The WAF enabled for your organisation. The Web Application Firewall section of the rule editor shows only when it is. Contact support to enable it.

Start in report mode. In report mode, the WAF logs what it would block, and blocks nothing.

  1. In the dashboard, open your project and go to Traffic > Rules.
  2. Open the actions menu of the proxy rule that reaches your application, and choose Edit.
  3. Scroll to Web Application Firewall.
  4. Turn on Web Application Firewall (WAF).
  5. Keep WAF mode at Report only. The other option is Block.
  6. Keep Paranoia level at 1 - Low (recommended).
  7. Select Update rule.

The Web Application Firewall section of the proxy rule. The Web Application Firewall (WAF) switch is on, WAF mode is Report only and Paranoia level is 1 - Low (recommended). Below are Allow rule IDs, Allow IPs, the block fields and the Block lists switches.

On the Rules page, the proxy rule now shows a WAF badge.

The Rules page. The proxy rule Portal origin has a WAF badge next to its name.

Leave the WAF in report mode for a few days of normal traffic and normal editing. Then read the hits:

  1. In the project, go to Compute > Edge function logs.
  2. Turn on Include WAF hits.
  3. Choose a time range, for example Last 1h.

The Edge function logs page with Include WAF hits turned on. Each row has the level WAF-HIT and a message such as WAF hit for URL: /.env.

Each hit shows as a line such as WAF hit for URL: /.env?cb=12345. The line includes the query string of the request. The log is up to about 10 minutes behind, and lines are kept for 31 days.

The rule ID, the IP address and the mode of each hit are on Security > WAF logs, and in the output of quant waflogs.

Look for:

  • Hits on requests that your visitors or editors make on purpose. These are false positives.
  • The rule IDs that fire most often.
  • Requests that are clearly attacks, such as probes for /.env or /wp-config.php.

If a rule fires on real visitors:

  1. Edit the proxy rule.
  2. In Allow rule IDs, enter the rule ID and press Enter. The WAF no longer applies that rule on this proxy rule.
  3. Select Update rule.

Common rules to review for CMS sites:

Rule Range Type Notes
920xxx Protocol enforcement May flag complex query strings
930xxx Local file inclusion May flag file upload paths
941xxx XSS protection May flag rich text editors
942xxx SQL injection May flag search queries

See the CRS rule documentation for details on specific rules.

Requests from addresses in Allow IPs bypass the WAF checks. Add your office, CI/CD servers or admin addresses:

  1. In Allow IPs, enter each IP address or CIDR range and press Enter.
  2. Select Update rule.
203.0.113.0/24
192.0.2.50

In Block lists, turn on:

  1. Known bad bots
  2. Known bad referers
  3. Known bad IPs
  4. Optional: AI crawlers, to block AI crawlers

You can also block your own lists in Block IPs, Block User-Agents, Block referers and Block ASNs.

When the hits are only attacks:

  1. Edit the proxy rule.

  2. Set WAF mode to Block.

    The Web Application Firewall section with WAF mode set to Block and Paranoia level at 1 - Low (recommended).

  3. Select Update rule.

Wait a few minutes after the change. Then send a request that the WAF blocks, with a cache-busting query string:

Terminal window
curl -sI "https://www.example.com/.env?cb=$RANDOM"

The response is 403 from Quant, and the quant-waf-rule header names the rule that matched:

HTTP/2 403
quant-waf-rule: 930130

Then request a normal page. It still comes from your application with its usual status. In report mode, the same /.env request goes on to your application and the hit is only logged.

If a rule blocks real visitors, add its ID from the quant-waf-rule header or the log to Allow rule IDs.

The Rate limiting section has three types. Each one has a Mode: Disabled (the default), Report, Block or Bot Challenge. Each rate limit follows its own Mode, not WAF mode: a rate limit set to Block blocks even while WAF mode is Report only. In Block mode, a rate-limited request gets a 429.

The Rate limiting section with its three types, each with Mode set to Disabled and the default values. Below it are WAF Slack webhook and Min RPM to notify.

Limits requests per IP address:

  1. Set Mode. Start with Report.
  2. Set Requests/second: the threshold (default 10).
  3. Set Cooldown (seconds): how long the address stays limited (default 30).

Limits requests grouped by a request header (useful for API rate limiting):

  1. Set Mode.
  2. Set Header name, for example X-API-Key.
  3. Set Requests/second (default 5) and Cooldown (seconds) (default 30).

WAF hit rate limiting (auto-ban on repeated violations) limits an IP address that triggers WAF rules again and again. Set Mode, Hits threshold (default 10), Within minutes (default 5) and Cooldown (seconds) (default 300).

WordPress sites often need these rule adjustments:

Allow rule IDs:

941100 # XSS filter for admin WYSIWYG
942100 # SQL detection in search

Recommended settings:

  • Paranoia level: 1 - Low (recommended)
  • Turn on all block lists
  • IP rate limit: 100 RPS (high due to asset requests)

Allow rule IDs:

941100 # XSS filter for CKEditor
941160 # XSS filter for AJAX
942100 # SQL detection in search

Recommended settings:

  • Paranoia level: 1 - Low (recommended)
  • Turn on all block lists
  • IP rate limit: 100 RPS

For a password in front of the CMS admin and login paths, see Protect admin areas.

For JSON APIs with sensitive operations:

Recommended settings:

  • Paranoia level: 2 - Medium
  • Header-based rate limiting on API keys
  • Lower IP rate limits (10-20 RPS)
  • Consider POST-only WAF via separate proxy rules

The WAF inspects proxy rules only. Pages served from static content are not inspected, because no application handles them. On a static site, turn on the WAF for each proxy rule that reaches an application (forms, search, an API), with:

  • Block lists turned on
  • Low rate limits (10-20 RPS sufficient)
  • Paranoia level: 1 - Low (recommended)

To get WAF alerts in Slack:

  1. In WAF Slack webhook, enter your Slack incoming webhook URL.
  2. Optional: in Min RPM to notify, enter a number of hits per minute. Quant then notifies only when hits exceed that rate (e.g., 10).
  3. Select Update rule.

Notification emails can be set only by Quant support.

After enabling block mode, continue monitoring:

  • Review WAF hits weekly for new attack patterns
  • Check for false positives affecting legitimate users
  • Adjust rules as your application changes

When you see attack patterns:

  1. Identify the source: check IP addresses and patterns
  2. Add to Block IPs if attacks persist from specific IPs
  3. Adjust rate limits if under sustained load
  4. Review notifications for attack severity

The Paranoia level setting maps to the OWASP Core Rule Set paranoia levels:

Level Description Use case
1 - Low (recommended) Standard protection Most websites
2 - Medium Stricter rules APIs, sensitive applications
3 - High Aggressive filtering High-security requirements
4 - Extreme Maximum strictness Rarely needed; expect false positives

Higher levels may require more rule tuning to avoid false positives.

  1. Find the blocked request in the WAF hits, or read the quant-waf-rule header of the response
  2. Note the rule ID
  3. Add it to Allow rule IDs if appropriate
  4. Or add the address to Allow IPs if it’s a known-good source
  1. Check that WAF mode is Block. Report only logs hits and blocks nothing
  2. Check that the request goes through the proxy rule that has the WAF on. Static content is not inspected
  3. Test with a cache-busting query string. A response already in the cache is served without a check of the rules
  1. Increase the Requests/second threshold
  2. Consider page asset count in your calculations
  3. For authenticated users, consider header-based limiting instead
  1. Check if your API client sends unusual headers
  2. Verify request bodies aren’t triggering SQL/XSS rules
  3. Consider a separate proxy rule with custom WAF settings for API paths