Web application firewall (WAF): what it does, whether you need one, and how to change its rules safely
A web application firewall reads each request on its way to your website and blocks or records the ones that match its rules.
This guide answers whether one is worth having for your business, what it cannot do, how to change its rules without blocking real customers, and how to test that it behaves the way you think. The worksheet on this page turns that into a record your team can fill in.
In this guide
WAF rule-change worksheet, staging tests and evidence template
Part A records each rule change: its purpose, the requests it should and must not affect, its starting mode, size limits, approver, rollback and what is watched afterwards. Part B is a set of staging test cases in four groups: false positives, variants of one harmless marker, content types and body size, and direct origin access.
How to use itHide the instructions
Part C is an evidence sheet for matching edge and application logs, and part D is an invented worked example of a small shop moving a rule set from log-only to blocking.
web-application-firewall.txt
Introduction3 lines
Part A. Rule-change worksheet25 lines
Part B. Staging test cases63 lines
Part C. Evidence template: edge log against application log20 lines
Part D. Worked example (an illustration)37 lines
Whole template156 lines
WAF RULE-CHANGE WORKSHEET, STAGING TEST CASES AND EVIDENCE TEMPLATE (VERSION 1)
For a WAF and a staging site you own or are authorised in writing to test, within your WAF provider's and your host's testing terms. The test cases use one harmless marker string and your own ordinary requests. They contain no attack payloads and are not a method for testing anyone else's WAF.
How to use it: fill in part A once for each change, pick the cases from part B that the change could affect, and keep one part C sheet for each test request you send. Part D shows a completed example.
PART A. RULE-CHANGE WORKSHEET
A1. Change reference and date: ____
A2. Type of change (tick one):
( ) Turn on a managed rule set
( ) Raise its sensitivity (paranoia level or the product's equivalent)
( ) Add a custom rule
( ) Add an exception to a rule
( ) Move a rule or rule set from log-only to blocking
( ) Adopt a new version of a managed rule set from the provider
( ) Remove or loosen a rule
A3. What the change is for (the threat, finding, requirement or false positive it answers): ____
A4. Requests it should affect (host, path, method, field and content type): ____
A5. Requests it must not affect (forms, uploads, APIs, admin screens, payment and partner callbacks that share those paths): ____
A6. Where it applies (staging, production or both), and the product and setting it changes: ____
A7. Starting mode (tick one):
( ) Log-only: Count, Log, DetectionOnly or your product's equivalent
( ) Blocking on staging only, production unchanged
( ) Blocking everywhere (write down why a log-only period is skipped): ____
A8. Size limits: the documented body inspection limit for this product and resource, and what it does with a larger request (inspect what fits, treat as a match, treat as no match, or reject). Is that acceptable on the paths in A4? ____
A9. Staging cases from part B that this change needs (by number): ____
A10. Who approves the change (someone who can judge the cost of a blocked order, booking or enquiry, as well as the person who wrote the rule): ____
A11. Rollback: the exact setting to change back, who can change it outside business hours, and how you will confirm the rollback took effect: ____
A12. What gets watched after the change, and by whom: blocked and counted requests by rule ID and path; messages from customers or staff about forms, uploads or checkouts that fail; the application's own error and order counts: ____
A13. Change in effect everywhere (some products take time to apply a change across all locations; confirm before judging results): ____
A14. Decision after watching (tick one): ( ) keep ( ) tune with an exception, recorded as a new worksheet ( ) roll back
Signed off by: ____
PART B. STAGING TEST CASES
Each case gives the request in outline, the expected result at the edge (the WAF) and at the application, and a result line. Record every request on a part C sheet.
Set-up for groups B2 to B4: on staging only, add a temporary custom rule that blocks any request containing the made-up marker wafcheck-7c41, in every part of the request your product lets a rule inspect. Some products need a separate rule statement for each part (query string, body, headers, cookies, path). Write down the transformations the rule applies before comparing (none, lowercase, URL decode, recursive URL decode). Remove the rule when testing ends.
Group B1. False positives: ordinary requests your own site sends (no marker rule needed)
B1.1 Rich text. Save a product description or blog post through the real admin editor with headings, bold text, a bulleted list, a link and an embedded image.
Edge: allowed, no rule match. Application: saved and displayed as written. Result: pass / fail ____
B1.2 Code sample. Send a support or contact form message containing a short code sample of the kind your customers paste, with angle brackets, quotes and semicolons.
Edge: allowed. Application: received in full. Result: pass / fail ____
B1.3 Long field. Fill the longest free-text field your forms accept to its maximum length.
Edge: allowed. Application: stored without truncation. Result: pass / fail ____
B1.4 Uploads. Upload one file of each type the site accepts, including one at the largest size you allow, with a file name containing spaces and an apostrophe.
Edge: allowed. Application: stored, and the file opens. Result: pass / fail ____
B1.5 API payloads. Replay on staging the JSON your own front end sends for search, checkout and account updates, and each payment, shipping or CRM callback your site receives.
Edge: allowed. Application: processed as normal. Result: pass / fail ____
B1.6 Names and addresses. Search for a product name with an ampersand, register a customer called O'Brien, and save an address such as Unit 3/12 with a hash in a lot number.
Edge: allowed. Application: correct results and records. Result: pass / fail ____
B1.7 Staff actions. Run the admin actions staff use every day: bulk edits, exports, settings saves and report filters.
Edge: allowed. Application: completed. Result: pass / fail ____
Group B2. Variants of one harmless marker (temporary marker rule switched on)
B2.1 Baseline. GET /search?q=wafcheck-7c41
Edge: blocked by the marker rule. Application: no record. If this fails, stop: the rule is not active. Result: pass / fail ____
B2.2 Mixed case. GET /search?q=WafCheck-7C41
Edge: blocked if the rule converts to lowercase first. Application: record what it received. Result: pass / fail ____
B2.3 URL-encoded. GET /search?q=%77%61%66%63%68%65%63%6B%2D%37%63%34%31
Edge: blocked if the rule URL-decodes first. Application: record the value it decoded. Result: pass / fail ____
B2.4 Encoded twice. The same value with each percent sign itself encoded: %2577%2561%2566 and so on.
Edge: blocked only if the rule decodes recursively. Application: record whether it decodes once or twice. A rule that decodes once in front of an application that decodes twice is reading a different value from the one the application acts on. Result: pass / fail ____
B2.5 Form body. POST with Content-Type application/x-www-form-urlencoded and comment=wafcheck-7c41
Edge: blocked. Application: no record. Result: pass / fail ____
B2.6 JSON body. POST with Content-Type application/json and {"comment":"wafcheck-7c41"}, then again with the marker nested: {"items":[{"note":"wafcheck-7c41"}]}
Edge: blocked both times. Application: no record. Result: pass / fail ____
B2.7 Multipart body. The marker as a multipart form field, then as the name of an uploaded plain-text file (wafcheck-7c41.txt).
Edge: blocked both times. Application: no record. Result: pass / fail ____
B2.8 Header. The marker as the value of a custom header (X-Test-Marker: wafcheck-7c41), then inside the User-Agent header.
Edge: blocked if the rule inspects headers. Application: record whether it reads either header. Result: pass / fail ____
B2.9 Cookie. The marker as a cookie value (test_marker=wafcheck-7c41).
Edge: blocked if the rule inspects cookies. Application: no record. Result: pass / fail ____
B2.10 Path. GET /products/wafcheck-7c41
Edge: blocked if the rule inspects the path. Application: no record. Result: pass / fail ____
A case that is not blocked is a coverage gap, not a disaster. Decide for each one whether to widen the rule, add a transformation, or accept it in writing because the application never reads that part of the request.
Group B3. Content types and body size (marker rule switched on unless stated)
B3.1 Mismatched content type. The JSON body from B2.6 sent with Content-Type text/plain.
Edge: blocked, or refused because the content type is not allowed. Application: if it parses the body as JSON anyway and the edge let it through, that is a fail. Result: pass / fail ____
B3.2 Other formats the application accepts. Repeat B2.6 in each other format your application parses, such as XML or a vendor JSON type (application/vnd.api+json).
Edge: blocked, or refused. Application: no record. Result: pass / fail ____
B3.3 Malformed JSON. {"note":"ok""comment":"wafcheck-7c41"} (a missing comma before the marker's field).
Edge: blocked, or the request is refused somewhere as invalid JSON. Application: rejects the body. A fail is the application accepting the field while the edge let it through. Result: pass / fail ____
B3.4 Over the inspection limit. A field named padding filled with the letter a until the body is just over your product's documented inspection limit (A8), then the marker in a later field.
Edge: whatever A8 says it should do: block, refuse, or allow uninspected. Application: record whether the marker arrived. Pass is the result you chose in A8. Result: pass / fail ____
B3.5 Over the limit, no marker (marker rule may stay on). The same padding sent through a page that legitimately sends large bodies, such as an upload or a long rich-text save.
Edge: allowed. Application: processed. This checks that handling large requests does not break your own large forms. Result: pass / fail ____
Group B4. Direct origin access
B4.1 Straight to the origin. Send B2.1 to the origin server's own address instead of through the edge, for example: curl --resolve www.yoursite.example:443:(origin address) "https://www.yoursite.example/search?q=wafcheck-7c41"
Edge: no record, because the request never passed through it. Origin: refused before the application handles it (connection refused, timed out or a fixed 403). A fail is any response from the application. Result: pass / fail ____
B4.2 Without the edge's proof. If the origin checks a secret header or a client certificate, repeat B4.1 with the header missing, then with a wrong value, then without the certificate.
Origin: refused every time. Result: pass / fail ____
B4.3 Other doors. Repeat B4.1 over plain HTTP, over HTTPS, and on every other port the origin listens on, and against any second hostname the host gave the origin.
Origin: refused every time. Result: pass / fail ____
B4.4 Shared networks. If the origin accepts anything that comes from your edge provider's network, write down whether that also admits requests routed through other customers' accounts with the same provider, and whether a check unique to you (your own certificate or a secret header) is in place. Notes: ____
B4.5 Leaked addresses. Check whether the origin address appears in public DNS records (including SPF and TXT), in the headers of email your web server sends, or in old subdomains that still point at it. Notes: ____
PART C. EVIDENCE TEMPLATE: EDGE LOG AGAINST APPLICATION LOG
One sheet for each test request.
C1. Test case number and description: ____
C2. Time sent, with time zone: ____
C3. Shared request identifier: the value the edge adds and the application logs (Cf-Ray behind Cloudflare, X-Amz-Cf-Id behind CloudFront, or a request ID header your own proxy sets): ____
C4. Request in outline: method, host, path, content type, body size, and where the marker or test value was placed: ____
C5. Edge record: action (blocked, challenged, allowed, counted or logged), rule ID, rule set and version, the field the rule matched, the score if shown, and any oversize flag: ____
C6. Application record: received (yes or no), status code returned, what it did (stored, rejected, error) and the value it read for the tested field: ____
C7. Did the request reach the application? ____
C8. Expected result (from part B): ____ Actual result: ____ Pass or fail: ____
C9. Sensitive data removed from this sheet (passwords, card details, session tokens, personal details): ( ) yes ( ) none present
C10. Follow-up (exception, rule change, origin fix, logging fix or none), with its worksheet reference: ____
Reading a mismatch between the two logs:
Edge blocked it, application has no record: the block worked for this request.
Edge allowed it with no match, application processed it: expected for ordinary requests. For a marker request, the rule did not see the marker where it was placed: a coverage gap to fix or accept in writing.
Edge counted or logged a match, application processed it: the expected record in log-only mode. If the request was one of your own ordinary requests, it is a false positive to tune before you block.
Edge shows a block, but the application has the request too: the rule was not really blocking (still log-only, or the change had not reached every location yet), or the identifier is not the one you think. Check the mode and the mapping first.
Application has the request, edge has no record: it reached the origin without passing the edge (see group B4), or the edge view you are reading is sampled or does not record that kind of event.
Edge allowed it, application has no record: something in between stopped it (a cache answered, or a load balancer or host firewall refused it), or the application did not log it. Find out which; a request the application handled without logging is a finding in itself.
Edge flagged it as over its inspection limit and allowed it: the part beyond the limit was not inspected. Check that against A8 for this path.
PART D. WORKED EXAMPLE (AN ILLUSTRATION)
Invented for this page. The shop, its paths, its request identifiers and its logs are made up to show how the worksheet reads when it is filled in; nothing here records a real engagement. Rule 941320 and the paranoia level behave as the OWASP Core Rule Set documentation describes.
Setting: a small online homewares shop runs ModSecurity with the OWASP Core Rule Set at paranoia level 2 in front of its store, with the default inbound anomaly threshold of 5. The rule set has been running in DetectionOnly mode on production. Staff add products through an admin editor that saves HTML; customers can leave plain-text reviews.
A1. WAF-07. A2. Move a rule set from log-only to blocking.
A3. Block requests the rule set scores at or above the inbound threshold, in front of the storefront, checkout, accounts and admin.
A4. All paths on shop.example.
A5. Must not affect: product saves in /admin/products/, image uploads, the payment provider's callback to /webhooks/payments, the shipping label integration, customer reviews.
A6. Staging first, then production. Setting: SecRuleEngine from DetectionOnly to On.
A7. Blocking on staging only; production stays DetectionOnly until the staging cases pass.
A8. In DetectionOnly, ModSecurity inspects the part of an oversize body that fits and lets the rest through; with the engine On, a body over SecRequestBodyLimit is rejected by default. The shop checks the configured limit against its largest product image upload before switching. Acceptable: yes, after B3.5.
A9. B1.1 to B1.7, B2.1, B2.5, B2.6, B3.4, B3.5, B4.1, B4.3.
A10. The owner, who can judge the cost of a failed checkout, with the developer who made the change.
A11. Set SecRuleEngine back to DetectionOnly and reload the web server; the developer or the owner can do it. Confirm by resending B1.1 and seeing a logged match instead of a block.
A12. Blocked requests by rule ID and path, read each morning by the developer; the support inbox for failed orders and uploads, read by the owner; the day's order count against the same weekday a week earlier.
Staging results before any exception:
B1.1 Rich text: FAIL. Saving a product description with an h2 heading and a bulleted list was blocked.
C1. B1.1, product description save. C2. 10:42 AEST. C3. request_id stg-5d1e9a (set by the shop's proxy and written to both logs).
C4. POST /admin/products/1042/edit, application/x-www-form-urlencoded, 2.1 KB; field description contains <h2>Care instructions</h2> and a list.
C5. Blocked. Rule 941320, Possible XSS Attack Detected - HTML Tag Handler, paranoia level 2, matched ARGS:description. Inbound anomaly score 5, threshold 5.
C6. No record. C7. No. C8. Expected allowed; actual blocked; fail. C9. None present. C10. Exception WAF-07a.
The production DetectionOnly log showed the same rule matching the same field on product edits that included HTML.
B1.2 to B1.7, B2.1, B2.5, B2.6, B3.4, B3.5, B4.1 and B4.3: pass. B4.1 timed out at the origin, whose firewall accepts only the edge's addresses.
Exception WAF-07a (its own part A, summarised):
A3. False positive in B1.1. Only signed-in staff can write the description field, and the platform sanitises it before display.
A4. Rule 941320, field description, paths beginning /admin/products/ only. Every other rule keeps checking that field, and rule 941320 keeps checking every other field and path.
Exception as written, following the runtime exclusion pattern in the CRS documentation and placed before the rule set is included:
SecRule REQUEST_URI "@beginsWith /admin/products/" "id:1100,phase:1,pass,t:none,nolog,ctl:ruleRemoveTargetById=941320;ARGS:description"
On a hosted WAF, the equivalent is that product's narrowest exception: the one rule, on the one path, for the one field if the product allows it.
Staging results after the exception:
B1.1 Rich text: PASS. C3. request_id stg-61b0c4. C5. Allowed, no match. C6. Received, saved, 302 to the product page. C7. Yes. C8. Pass.
Control check: the same HTML sent in a customer review field (POST /reviews) was blocked by rule 941320, as intended for a field customers write.
Production switch: SecRuleEngine set to On and the web server reloaded. B1.1 and B1.4 repeated on production with staff test records: pass. Watching under A12 found no blocks on the shop's own traffic; the blocked requests were for paths the shop does not serve.
A14. Keep. Signed off by the owner.What a web application firewall is
A web application firewall, or WAF, sits between your visitors and your website and reads each web request before your application does.
It checks the request against a set of rules, and a request that matches can be blocked, challenged or simply recorded, depending on how the rule is set. OWASP's own page puts it in one line: a WAF is an application firewall for HTTP applications that applies a set of rules to an HTTP conversation, and those rules generally cover common attacks such as cross-site scripting and SQL injection.
OWASP adds that a WAF is deployed to protect a specific web application or set of applications, can be considered a reverse proxy, and may come as an appliance, a server plugin or a filter.
For a business website those forms turn up in three places: a service in front of the whole site, such as Cloudflare or Amazon CloudFront with AWS WAF, the two hosted examples this page draws on; a load balancer or gateway your host runs; or an engine inside the web server or the application, such as ModSecurity or OWASP Coraza running the OWASP Core Rule Set (CRS).
The rules have two sources. Managed rule sets are written and kept up to date by someone else: Cloudflare says its managed rulesets are regularly updated, AWS describes managed rule groups as predefined rules that AWS and AWS Marketplace sellers write and maintain, and OWASP describes the goal of the Core Rule Set as a pluggable set of generic attack detection rules that give a base level of protection to any web application.
Custom rules are the ones your own team writes for your own site, such as refusing requests to an admin path from outside the office.
Four neighbouring topics have guides of their own in this library. Rate limiting, which some WAF products include as a rule type, decides how many requests a client may send. Security misconfiguration covers the settings around the WAF, such as debug output and default accounts.
Security logging and monitoring covers turning WAF and application events into alerts someone acts on. The Cloudflare guide covers that provider's WAF, bot and origin settings in detail.
This page stays with what a WAF is and is not, how to decide whether one is worth having, how to change its rules without breaking the site, and how to test it.
Do you need a web application firewall?
The short answer for a business owner: a WAF is worth having when your site accepts input that matters, such as logins, payments, file uploads or forms that reach a database, or when it runs plugins and components you cannot always update the day a fix ships, and when someone will read what the WAF records.
For a static brochure site with no logins and nothing to submit, keeping the platform, theme and plugins updated comes first, and a WAF can follow. Either way it is a layer in front of your application, not a repair inside it.
Four questions settle it for a particular site.
What does the site accept?
List every input a customer or partner can send: logins, checkout, uploads, search, contact and quote forms, and any API your front end or a partner calls. Those are what WAF rules inspect, and they are also where false positives will appear, so the same list feeds the test cases in the worksheet.
How quickly can you patch?
If a plugin, theme or framework update takes days to test and release, a managed rule set may give you something in front of the known flaw in the meantime. Cloudflare describes its managed ruleset as covering known attack techniques and zero-day vulnerabilities and as updated frequently to address new threats and reduce false positives.
AWS says many AWS and AWS Marketplace sellers update their managed rule groups automatically and provide new versions when new vulnerabilities and threats emerge. The update to your own code is still the fix.
Who will look after it?
A WAF needs an owner. OWASP notes that customising a WAF to an application can take significant effort and has to be maintained as the application changes, and the CRS documentation warns that, depending on the application and the paranoia level, writing rule exclusions can be a substantial amount of work.
If nobody will read the logs or deal with a blocked customer, start at the lowest sensitivity: the CRS project describes its paranoia level 1 as baseline security with a minimal need to tune away false positives, meant for everybody running an HTTP server on the internet.
Does a standard you are assessed against ask for one?
PCI DSS is one standard where this question comes up, and the Council's own description of the relevant control does not name a WAF. The PCI Security Standards Council's FAQ 1593, dated March 2025, describes PCI DSS v4.x requirement 6.4.2, effective as of 31 March 2025, as deploying an automated technical solution to detect and prevent web-based attacks for public-facing web applications.
It supersedes requirement 6.4.1, which allowed either a review of public-facing web applications with application vulnerability security assessment tools or methods, or such a solution. The FAQ refers readers to the standard for the exact wording.
Whether your set-up meets it is a question for whoever assesses you against the standard. Qualified Security Assessor companies are qualified by the Council to validate an entity's adherence to PCI DSS. Clever Ops is not a Qualified Security Assessor or an Approved Scanning Vendor, so that question goes to an assessor.
What a WAF does not do
A dashboard full of blocked requests is reassuring, which is exactly why the limits are worth knowing before you rely on one.
It does not fix the flaw behind it
A rule that blocks a known attack pattern leaves the vulnerable code where it was. MITRE's entry for SQL injection, CWE-89, rates an application firewall as a mitigation of moderate effectiveness and notes that it might not cover all possible input vectors and that attack techniques might be available to bypass it.
OWASP's Top 10:2025 says the best way to prevent injection is to keep data separate from commands and queries. A WAF rule added because of a specific finding is interim, and should be recorded that way.
It cannot see who should be allowed to do what
A request for another customer's invoice can look exactly like a request for your own: the same path, the same format, a different number. Nothing in it resembles an attack, so a rule that reads requests for attack patterns has nothing to match.
The CRS documentation says a fresh deployment has no awareness of the web services running behind it, and OWASP's Top 10:2025 says access control is only effective when it is implemented in trusted server-side code or serverless APIs, where the attacker cannot modify the access control check or metadata.
Broken access control, and business logic flaws such as a checkout step that can be skipped, are found by testing the application signed in as each role.
It only guards the route it stands on
If the server behind the WAF answers requests sent straight to its own address, anyone who finds that address can leave the WAF out of the path entirely. Cloudflare's guidance on protecting an origin server and AWS's guidance on restricting a load balancer to CloudFront both exist to close that route, and the origin server protection section below sets out what they document.
It reads only part of a large request
Inspection stops at documented limits. AWS WAF inspects the first 8 KB of a request body behind an Application Load Balancer and, by default, the first 16 KB behind CloudFront, which can be raised in steps to 64 KB; when it lets a request through, the whole request goes on to your server, including the part it could not inspect.
Cloudflare says its managed rules inspect the body up to a maximum size that varies by plan and that content beyond the limit may not be fully analysed.
ModSecurity rejects a body over its configured limit by default, but in detection-only mode it inspects the part that fits and lets the rest through. Know your product's limit and what it does with a request that goes over it.
It does not watch itself
A WAF writes events; somebody has to decide what they mean. OWASP's Top 10:2025 lists application and API logs that are not monitored for suspicious activity, and penetration tests and DAST scans that do not trigger alerts, among security logging and alerting failures. The security logging and monitoring guide covers alerting. This page covers the WAF's half of the evidence.
Web application firewall rules: how they decide
Four settings shape what a WAF does with a request: which rules run, how sensitive they are, what happens on a match, and what text a rule compares.
A provider's update is a rule change you did not write. AWS lets you run a managed rule group on its default version, which AWS moves to whichever static version the provider currently recommends, or pin a static version and update it yourself.
For either, its advice is to subscribe to the provider's notifications and to test a new version, or review it before the default moves to it, setting rules to count if needed so they do not block while you decide.
AWS also notes that you cannot view all of the details of the individual rules in a managed group, which is one more reason to test with your own traffic. Cloudflare warns that an override applied to a whole managed ruleset or to a tag applies to future rules as well as existing ones, so a loosened setting can reach rules that did not exist when you made it.
The Core Rule Set does not block on the first rule that matches. In anomaly scoring mode each matching rule adds to a running score for the request, and once every rule that inspects the request has run, the request is denied if the total is greater than or equal to the inbound threshold.
The default threshold is 5, and a rule of critical severity scores 5 by default, so one critical match is enough. The CRS documentation warns that raising the threshold above its defaults lets a substantial number of attacks through, and that it should only ever be raised temporarily during false-positive tuning.
Cloudflare's implementation of the Core Rule Set works on the same idea in its own terms: each matching rule adds to a cumulative threat score, and the configured action runs when the score exceeds the threshold.
Sensitivity is set separately, and the CRS documentation is careful to keep the two apart: the paranoia level controls how many rules run, while the threshold controls how many can match before a block. Levels run from 1 to 4, each adding rules to the one below.
The CRS project describes level 2 as adequate when real user data is involved, perhaps an off-the-shelf online shop, where you should expect false positives and learn to tune them away; level 3 as online banking level security with lots of false positives; and level 4 as for use at your own risk.
It also notes that some products built on the Core Rule Set let you set the paranoia level and some do not.
Each product on this page has a way to record a match without acting on it, and that is where a change should start. AWS calls it count mode, and recommends testing and tuning in a staging or testing environment first, then testing and tuning rules in count mode with production traffic before enabling them.
Cloudflare's Log action records matching requests and is recommended in its documentation for validating rules before a more severe action; its availability depends on the plan. ModSecurity's DetectionOnly engine setting processes rules but never executes disruptive actions such as block or deny.
For a new CRS deployment, the CRS documentation also describes a common practice: start in blocking mode from the beginning with a very high anomaly threshold and lower it step by step. Its anomaly scoring page also warns that a threshold above the defaults will allow a substantial number of attacks to bypass CRS, and that the threshold should only ever be raised temporarily during false-positive tuning.
Raising sensitivity on an installation that is already running is covered in the section on changing rules below.
A rule compares text, so it matters which version of the text it sees. AWS WAF lets a rule apply text transformations before inspection, such as URL decoding and conversion to lowercase, and describes them as removing some of the unusual formatting attackers use to try to get past it.
Cloudflare's rules language has functions for the same jobs, such as lower() and url_decode(), and its documentation shows url_decode() turning %2520 into %20 unless recursive decoding is switched on.
For a custom rule, you choose the transformations, and the marker tests in the worksheet show whether you chose the ones your application needs.
WAF false positives and how to tune them away
A false positive is a genuine request that a rule matches in error.
The CRS documentation explains why they happen: a generic rule set knows nothing about the application behind it, so ordinary traffic that resembles an attack pattern gets flagged. Its own example is a WordPress post containing an HTML heading, which a cross-site scripting rule at paranoia level 2 matches because of the tags, even though WordPress has its own rules for which tags are allowed.
On a business site, start with the requests your own staff, customers and partners send that do not look like ordinary form fields: product descriptions and posts from a rich-text editor, code samples pasted into support forms, very long free-text fields, file uploads, JSON from your own front end, callbacks from payment and shipping providers, and names and addresses with apostrophes, ampersands and slashes.
The CRS documentation gives three reasons to fix them rather than live with them. When a system is prone to false alarms, its alerts may be ignored and real attacks overlooked. A false-positive alert can copy sensitive data into a log, such as a password that happens to contain a string a rule looks for. And when real customers are blocked, the pressure builds to switch the WAF off altogether.
Write the narrowest exception that works
Tuning means adding an exception, not editing the rule. The CRS documentation strongly discourages changing rule files directly, because the next rule set update undoes the change, and it describes exceptions at several widths. Its examples use the wide ones only where the application does not use what the rules protect, and the narrow one where removing the rule entirely is unacceptable.
- Widest:remove a whole category of rules, such as every SQL injection rule. The CRS example does this only where no web service behind the WAF uses SQL.
- Wide:remove one rule everywhere, as in the CRS example of a PHP rule in front of an application that uses no PHP.
- Narrower:remove one rule, or one category, for one path only.
- Narrowest:exclude one field from one rule on one path, so the rule keeps checking every other field and page.
Record it so it can be reviewed
Products name exceptions differently. Cloudflare's exceptions skip managed rules for requests that match an expression, and only skip the managed rulesets listed after them, so their position in the list matters. AWS documents overriding a managed rule's action to count.
Whatever the name, record the rule ID, the field, the path and the reason, so the exception is reviewed when the form changes or the rule set is updated. Part D of the worksheet shows one written up in full.
Changing WAF rules without breaking the site
Every change should follow the same path, whether it is turning on a managed rule set, raising its sensitivity, adding a custom rule, adding an exception, moving from log-only to blocking or accepting a provider's new version.
The worksheet on this page is that path written down.
- Say what the change is for and which requests it should touch. A rule meant to protect the login form should name the login path; one that also catches checkout is a different change.
- Name the approver. Someone who can judge the cost of a blocked order or enquiry signs off, as well as the person who wrote the rule.
- Start in a recording mode where the product offers one, and on staging before production.
- Run the staging cases, starting with your own ordinary requests, then watch production in recording mode and read every match. A match on a request you recognise as normal is a false positive to tune. A match on something you do not recognise needs a closer look before you decide.
- Switch to blocking, then confirm the change is in effect everywhere before judging it. AWS notes that changes take time to propagate, and that during propagation a changed rule action can show the old action in some places and the new one in others.
- Watch the same signals afterwards: blocks by rule and path, customers or staff reporting forms that fail, and the application's own error and order counts.
- Keep the rollback written down: the exact setting, who can change it outside business hours, and how you will know it took effect.
Raising sensitivity on a site that already works
Raising the paranoia level of a working Core Rule Set installation is very likely to bring new false positives, by the CRS documentation's own account. It calls the shortcut of raising the anomaly threshold for a while simple but risky, because it lets through attacks that were blocked before.
Its alternative is an executing paranoia level set above the blocking one: the higher level's rules run and log but never count towards the blocking score, the new false positives are tuned away, and then the blocking level is raised to match.
Where a product does not expose this setting, the nearest equivalent is to add the stricter rules in its log-only mode first, if it has one.
WAF testing: checking it does what you think
A WAF test asks two questions: does the rule stop what it is meant to stop, and does it leave your customers alone?
Both are answered on a staging copy behind the same WAF configuration as production, using requests you control. Test only a WAF and a site you own or are authorised in writing to test, and read your WAF provider's and host's testing terms first. Nothing on this page is a method for getting past someone else's WAF.
For false positives, the test cases are your own traffic: a real product description with headings and links, a support message with a code sample, the longest form field the site allows, each type of upload, and the JSON your front end and partners send. Each one should pass the edge and reach the application unchanged.
For coverage, use a harmless marker instead of attack strings. On staging, add a temporary custom rule that blocks one made-up string no real request contains, such as wafcheck-7c41, then send that marker in different forms and places. Each request either reaches the rule or slips past it, and the pattern tells you what your WAF inspects and how it reads what it inspects, without sending anything that could harm the application. Remove the rule when you finish.
- Encodings of the same marker: plain, in mixed case, URL-encoded, and URL-encoded twice. Whether each is caught depends on the transformations the rule applies, and the result to look for is agreement with how your application decodes the same value.
- Body formats and content types: the marker as a query parameter, a form field, a JSON value, a multipart field and an uploaded file name, then the same JSON sent with a content type that does not match it. The CRS documentation says ModSecurity and Coraza rely on the Content-Type to parse a request body, and warns that allowing an extra content type without the matching body parser may result in a complete bypass of the WAF. AWS documents that when JSON parsing fails, its default is to evaluate the body only up to the parsing error.
- Placement: the marker in a header, a cookie and a path segment instead of a parameter. AWS WAF reads at most the first 8 KB and first 200 headers when a rule inspects all headers, and a single named header in full, and each AWS rule statement inspects one part of the request, so covering several parts takes several statements.
- Size: the marker placed after enough harmless padding to push the body past your product's documented inspection limit. The right result depends on your oversize setting. AWS WAF can continue with what fits, treat the request as a match, or treat it as no match, and outside its console the default is to continue. Cloudflare provides a field, http.request.body.truncated, that custom rules can use to act on bodies that were not fully inspected, where the plan includes body fields.
- Direct origin access: the same marker sent to the origin server's own address, skipping the edge. The expected result is a refusal before the application handles it.
Keep the tests and run them again
Save the cases and rerun them after every rule change and every provider update. OWASP's Top 10:2025 recommends an automated process to verify the effectiveness of configurations in all environments, and a staging run of these cases is a practical version of that for a WAF.
Check, too, that the test requests appear where your team will see them: OWASP lists penetration tests and DAST scans that trigger no alerts among its logging and alerting failures.
Origin server protection: make the WAF the only way in
A WAF at the edge only sees requests that come through the edge.
If the origin, the server behind it, accepts connections from anywhere, the WAF is a front door beside an open side gate. Cloudflare and AWS both document how to close the gate, and their approaches fall into three groups.
Keep the address out of view
Cloudflare advises proxying DNS records so the origin's address is not published, checking DNS-only records such as SPF and TXT for origin addresses, not hosting mail on the same server where possible because bounced mail reveals its address, and rotating origin addresses after moving behind Cloudflare because historical DNS records are kept.
Hiding an address helps, but an address that has leaked once stays known, so treat this as the first step rather than the control.
Remove the public address
Cloudflare Tunnel connects the origin to Cloudflare through outbound-only connections, with no publicly routable address. AWS documents CloudFront VPC origins, which serve content from applications in private subnets without exposing them to the public internet.
Accept only requests that prove they came through the edge
AWS documents CloudFront adding a secret custom header to origin requests, with the load balancer forwarding only requests that carry it and answering everything else with a fixed 403. It says the approach only works while the header name and value stay secret, recommends HTTPS to the origin and rotating the header, and documents an optional AWS-managed prefix list that lets the load balancer's security group refuse traffic that does not come from CloudFront.
Cloudflare documents the same header approach, rated moderately secure, and allow-listing its IP ranges, also rated moderately secure and noted as vulnerable to IP spoofing.
Its Authenticated Origin Pulls has the origin check a client certificate; Cloudflare notes that its own certificate only shows a request came from the Cloudflare network, and says to upload your own certificate for stricter checking.
Whichever route you take, test it from outside: request the origin directly, with and without the expected header or certificate, on every port and hostname it answers, and expect a refusal each time. Group B4 of the worksheet lists those requests. The Cloudflare guide covers that provider's settings step by step.
Matching WAF events to application logs
A WAF log cannot say on its own what happened next.
Did a blocked request still reach the application by another route? Did a request that matched a counting rule fail inside the application? To answer either, you need one identifier present on both sides.
- Cloudflare sends a Cf-Ray header, its Ray ID, to the origin, and says to add it to origin server logs so requests through Cloudflare can be matched to requests in your server logs. It notes that with Argo Smart Routing or Argo Tiered Caching, the three-letter location code in the header sent to the origin names the data centre connecting to the origin rather than the one that first received the request.
- CloudFront adds an X-Amz-Cf-Id header to each request it forwards to a custom origin, containing an encrypted string that uniquely identifies the request. AWS WAF logs a requestId generated by the AWS service it is attached to, which for an Application Load Balancer is the trace ID. Confirm on staging which identifier lines up with which before you depend on it.
- On a server running ModSecurity, the example log line in the CRS documentation carries a unique_id value beside the rule ID, the matched data and the requested URI. If your own proxy sets a request ID header, log it at the WAF and in the application, and the two records join on that value.
What each side should record
OWASP ASVS 5.0 requirement 16.2.1, at Level 2, asks that each log entry includes the necessary metadata, such as when, where, who and what, that would allow a detailed investigation of the timeline. For WAF evidence, that means the time, the shared identifier, the method and path, the rule ID and action at the edge, and the status code and outcome in the application. Part C of the worksheet is laid out that way.
Read the edge side with its quirks in mind. Cloudflare's Security Events view shows security events, not requests, so one request can appear as several events, and its sampled logs may leave some events out when traffic is heavy. AWS WAF logs the rule that terminated the request, or Default_Action when none did, lists non-terminating matches such as count rules separately, and lists any inspected field that was over its size limit.
AWS adds that inspection stops at the first terminating match, so a request may contain other threats beyond the one logged.
Redact before you share
The CRS documentation warns that a false-positive alert can write sensitive data such as a password into the log, and ASVS 5.0 requirement 16.2.5 says some data, such as credentials or payment details, may not be allowed to be logged at all. Strip passwords, card details, session tokens and personal details from evidence sheets before they go into a ticket or an email.
Where an outside test fits
A WAF and a security test answer different questions.
The WAF filters requests at the edge; a test shows what the application does with the requests that get through. Clever Ops tests what customers reach through a browser or an API: websites, WordPress sites and WooCommerce stores, custom web applications and their APIs, apps made with AI builders, and AI chatbots and agents.
Its services do not include managed IT, round-the-clock monitoring or incident response, so watching WAF alerts stays with your team, your host or your provider.
A WAF shapes how a test is scoped. The scope records whether the WAF lets the tester's addresses through and in which environment: letting them through on staging tests the application itself, while leaving the WAF in place on production tests what an attacker meets, and the choice is written down because it changes what the report can say.
Requests stay under an agreed rate, and testing on a target pauses if a firewall starts blocking. If you switch on a WAF rule as an interim measure after a finding, it belongs in the fix note, and the retest runs under the original conditions so the result describes the application; if the rule is the remedy you have chosen, the outcome names it as the control that was tested.
For a site without customer logins, a website security audit is the external starting point: it reviews what anyone on the internet can examine without logging in, and the report states what an outside view cannot reach. If Clever Ops built or hosts your site, the work is a security review rather than an independent test, and the report says who built it and who hosts it.
Frequently asked questions
It reads each web request before your application does, compares it with a set of rules, and blocks, challenges or records the requests that match. OWASP describes those rules as generally covering common attacks such as cross-site scripting and SQL injection. It does not change your application's code, so a flaw a rule is covering is still there behind it.
No. A network firewall controls which connections can reach a server. A WAF works on the web requests inside the connections that are let through, which is where form fields, headers, cookies and JSON bodies are. OWASP describes it as an application firewall for HTTP applications. One does not replace the other.
The PCI Security Standards Council's FAQ 1593 describes PCI DSS v4.x requirement 6.4.2, effective as of 31 March 2025, as deploying an automated technical solution to detect and prevent web-based attacks for public-facing web applications, and refers readers to the standard for the exact wording. It does not name a product. A Qualified Security Assessor can say what meets it in your environment. Clever Ops is not a Qualified Security Assessor or an Approved Scanning Vendor.
A legitimate request that a rule matches as if it were an attack, such as a product description with HTML headings matching a cross-site scripting rule. Where the rule is still needed elsewhere, the Core Rule Set documentation's examples use a narrow exception: exclude the one field from the one rule on the one path, so the rule keeps checking everything else.
Start where you can see matches before customers feel them. AWS recommends testing on staging, then running rules in count mode on production traffic before enabling them, and Cloudflare recommends its Log action, where the plan includes it, for validating rules before a more severe action. The Core Rule Set documentation describes another common practice, blocking from the start with a very high threshold that is lowered step by step. Whichever you choose, read every match before you tighten it.
There are documented gaps a defender should test for. If the origin server answers requests that do not come through the WAF, the WAF can be left out entirely. Inspection stops at documented size limits. MITRE's CWE-89 notes that an application firewall might not cover all input vectors and that techniques might be available to bypass it. This page shows how to check your own WAF for those gaps on staging; it is not a guide to getting past anyone else's.
Ask four questions. Does it read web requests, or only filter connections? Which rules run, and who updates them? Is it blocking, or only recording? Can the server behind it be reached without going through it? The answers tell you what it covers, and the worksheet on this page gives you a way to check each one on staging.
It can, if it starts blocking the tester partway through, and testing on that target then pauses. Agree it in the scope instead: whether the WAF lets the tester's addresses through, and in which environment. Let through on staging, the test describes the application; left in place on production, it describes what an attacker meets.
Scope the right test for your application
Tell us what you have built, who uses it and when it needs to launch. You will get a plain-English recommendation: a website audit, a web application test or a referral to a specialist.