Web application firewall
NullWard inspects requests with the OWASP Core Rule Set (CRS 4) and any custom rule sets you add. It also inspects responses.
Turn the WAF on for a service
Open the service and go to its WAF tab. The WAF works in two directions, each set on its own (NullWard 0.6.99 or later):
- WAF: Requests inspects what clients send.
- WAF: Responses inspects what the application sends back, to stop data leaks: SQL and application errors, stack traces, source code, directory listings.
Each direction has three modes:
- Block: enforce the rules. A blocked request gets the block page; a blocked response is replaced by the block page.
- Audit: record what would have been blocked, without blocking. Audit events appear under Security Events > WAF Events with the Audit only filter. Notifications and behaviour scoring are skipped for them.
- Off: that direction isn't inspected.
For example, Requests: Block with Responses: Audit enforces the request rules while you tune the response rules. When requests are in Audit or Off and responses are inspected, a request that would have been blocked still reaches the application, and its response is checked.
When WAF: Responses isn't Off, three more settings appear. Leave them empty to use the global defaults under Settings > WAF Engine:
| Setting | What it does |
|---|---|
| Response Bodies | Inspect checks response bodies as well as the status and headers; Headers only doesn't. Most data-leak rules need the body. Use global default follows Response Body Inspection (off unless changed). |
| Response Inspection Limit (bytes) | How much of each response body is inspected, up to 16 MiB (16777216). |
| Outbound Anomaly Threshold | The score at which a response is blocked. Raise it to make response blocking less strict. |
Leave OWASP Core Rule Set on. Turning it off leaves only your custom rule sets.
The tab starts with How the WAF works for this service: the two directions as a flow with their current modes, a sentence saying what the settings do, and how modes, exclusions and bypass paths work. Exclusion forms warn when the chosen direction can't apply to a rule ID (for example a response rule excluded for requests only).
The WAF tab: requests in Block, responses in Audit
WAF settings on a service: response options and bypass paths
[!TIP] Run a new service in Audit for a while, review its WAF events, and add whitelist rules for any false positives. Then switch it to Block. Response rules often need more tuning than request rules, so it can help to block requests while responses stay in Audit.
[!NOTE] Upgrading to 0.6.99 keeps every service's behaviour: a service whose WAF was on in Block blocks both directions, one in Audit only audits both, and one with the WAF off has both directions off. Existing whitelist rules apply to both directions. The API's older
waf_enabledandwaf_modefields still work and set both directions.
How blocking decisions are made
The CRS uses anomaly scoring. Each matching rule adds points by severity: critical 5, error 4, warning 3, notice 2. A request is blocked when its total reaches the Inbound Anomaly Score Threshold, and a response when its total reaches the Outbound Anomaly Score Threshold.
Global WAF settings are under Settings > WAF Engine:
| Setting | Default | Notes |
|---|---|---|
| Paranoia Level | 1 | 1–4. Higher levels catch more evasion techniques but produce more false positives. Most deployments use 1 or 2. |
| Inbound Anomaly Score Threshold | 5 | 5 is strict: one critical rule blocks. 10 is a common starting point for production. 25 or more is close to detection-only. |
| Outbound Anomaly Score Threshold | 4 | Applies to responses. |
| Allowed HTTP Methods | GET HEAD POST OPTIONS | Space-separated. |
| WAF Audit Logging | Off | Detailed per-request rule logs, for troubleshooting only. |
Settings > WAF Engine
Request bodies
Request bodies are inspected up to the Body Inspection Limit (default 128 KiB), however they are sent: with a Content-Length, chunked, or over HTTP/2 or HTTP/3. Over-Limit Bodies decides what happens to larger bodies:
- partial (default): the first part is inspected and the whole body is forwarded. An attack placed entirely after the limit isn't inspected.
- reject: larger bodies are refused with HTTP 413 and recorded as a WAF block.
Each service can override both settings on its WAF tab. Raising the limit costs memory and CPU on every large request.
[!NOTE] Binary uploads, such as container image pushes (
application/octet-stream), are inspected too, and the CRS often blocks them. Give those endpoints a WAF bypass path or a whitelist rule.
Compressed request bodies
A request body sent compressed (with a Content-Encoding header) is blocked by default: the CRS refuses the header (rule 920450) because a compressed body can't be inspected. To accept compressed request bodies, turn on Decompress Request Bodies in the service's Compression section (NullWard 0.6.91 or later). Then:
- Bodies compressed with gzip, deflate or Brotli (
br) are inspected decompressed, and the backend receives them unchanged, still compressed. - The Body Inspection Limit applies to the decompressed size, so a small body that expands enormously (a "zip bomb") is handled like any other large body: partial inspects the first part, reject answers 413.
- A body labelled gzip, deflate or
brthat can't be decompressed is blocked with HTTP 400. - Other encodings, such as
zstd, are still blocked. - With Malware Scanning on, the scan also sees the decompressed body.
Response inspection
Responses are inspected when the service's WAF: Responses is Audit or Block. The status and headers are always checked. Bodies are checked when Response Bodies is Inspect, or when it uses the global default and Response Body Inspection is on under Settings > WAF Engine.
- Inspected body types:
text/html,text/plain,text/xml,application/json,application/problem+jsonandapplication/xml. - Up to the Response Inspection Limit (default 128 KiB) of each body is inspected. That part is held back until it has been checked.
- Responses compressed with gzip, deflate or Brotli (
br) are decompressed for inspection. The visitor receives the original compressed bytes. - Not inspected: other content types (images, downloads), other encodings such as
zstd, server-sent events and WebSockets.
If a response reaches the outbound threshold, the visitor gets the block page instead in Block; in Audit the response is sent and the event is logged. Response events are marked outbound under WAF Events.
Whitelist rules
A whitelist rule switches off specific rules for specific requests, so you can fix a false positive without weakening protection elsewhere. A rule matches when all of its conditions match:
- Service: one service, or Global (\*) for all.
- Path Pattern (regex): for example
^/api/upload$. - Methods: for example
POST, PUT, or*for all. - Rule IDs: the rules to switch off, for example
942100, or*for all. - Direction: Both directions (the default), Requests (inbound) or Responses (outbound). A rule for one direction leaves the other direction's rules running, so a false positive in responses doesn't weaken request inspection on the same path.
- Expires At (optional): the rule stops applying after this time.
The listed rules are removed for matching requests. The rest of the rule set still runs, including the anomaly threshold. Rules created before 0.6.99 apply to both directions.
Adding a whitelist rule for responses only
Create a rule from a WAF event
The fastest way to handle a false positive:
- Go to Security Events > WAF Events. Events are grouped by service, path and rule, with a hit count.
- Click Create Rule on the event. The form is pre-filled with the service, the exact path, the method, the rule ID and the direction (an outbound event gets a Responses rule).
- Widen the path if you need to. Normalized (all IDs) matches the same path with any IDs in it, for example every
/orders/<id>. - Optionally tick Dismiss events after creating rule, then save.
All whitelist rules are listed under Access Control > WAF Whitelist.
WAF events
WAF bypass paths
A service's WAF tab has two lists of path regexes:
- Request Bypass Paths (inbound): requests to these paths skip WAF inspection entirely: the CRS and all rule sets. Use them only for endpoints that can't be inspected, such as webhook receivers or binary upload APIs. Authentication and the ML WAF still apply.
- Response Bypass Paths (outbound): responses from these paths aren't inspected, for example large exports or downloads. Shown when WAF: Responses isn't Off. Services from before 0.6.99 start with the same list as their request bypass paths.
To skip only certain rules, use a whitelist rule instead.
Custom rule sets
Under Access Control > WAF Rule Sets you can write your own rules in SecLang, the ModSecurity rule language.
- Allowed directives are
SecRule,SecAction,SecMarker, and theSecRuleRemove*andSecRuleUpdate*directives. - Rule IDs must be between 1 and 899999. IDs 900000–999999 are reserved for the CRS.
- Rules are validated as you type.
- A rule can deny a request outright, or add to the anomaly score so that it combines with the CRS.
- Tick Global to apply a rule set to every WAF-enabled service, or add it to particular services under each service's Security > Custom Rule Sets.
- Rule sets can be exported and imported as
.nwrules.jsonfiles.
Rules load in this order: CRS detection rules, global rule sets, the service's rule sets in the order listed, then the CRS blocking evaluation.
WAF rule sets
Exception requests
Exception requests from blocked visitors who think the block was a mistake are listed under Security Events > Exception Requests, filtered by status (pending, approved or rejected). Approve creates a whitelist rule for that method, path and rule ID; Reject declines it. Both accept an optional review note.
Per service, Exception Auto-Approval can be set to Auto-approve Authenticated Users instead of Queue for Review.
Block pages
Under Administration > Block Pages you can edit the page shown for each kind of block: WAF, rate limit, access denied, bot challenge, IP reputation, malware, IP allowlist and more. You can change the title, add your logo and edit the content blocks, with a live preview.

