Explainers · Explainer
What Is a Web Application Firewall? A Plain Explanation

Short answer
A web application firewall, or WAF, is a filter that sits in front of a website and blocks web requests that look like attacks. It reads each HTTP request at the application layer, checks it against rule sets, and blocks, challenges, or logs the ones that match known attack patterns. It protects against injection and cross-site scripting, but it does not fix bad code.
Key takeaways
- A WAF filters web requests before they reach your site and blocks ones that match known attack patterns.
- A network firewall filters by IP and port; a WAF reads what is inside the web request itself.
- The OWASP Top 10 lists the most critical web risks, and a WAF is strongest against injection attacks.
- Cloudflare includes a WAF with a Free Managed Ruleset on its free plan; fuller rules start at $20 a month.
- The OWASP Core Rule Set scores each request and blocks it only when the score passes a threshold.
- A WAF cannot fix broken access control, weak passwords, or unpatched plugins.
What is a web application firewall?
A web application firewall, or WAF, is a filter that sits in front of a website and blocks web requests that look like attacks.
Cloudflare defines its WAF plainly: it checks incoming web and API requests and filters out undesired traffic based on sets of rules called rulesets. OWASP, the Open Worldwide Application Security Project, defines a WAF as a security layer on the web application level that does not depend on the application itself.
Think of it as a bouncer for your site. Every visitor's request is checked at the door, and requests carrying known attack patterns are turned away before they reach WordPress.
How does a WAF work?
A WAF reads each HTTP request, checks it against its rules, and then forwards it, blocks it, or logs it.
The WAF sits between visitors and your site, usually as a reverse proxy, so every request passes through it first. Cloudflare says its WAF filters traffic by request properties such as IP address, URL path, headers, and body content, using a flexible expression syntax called the Rules language.
The rules look for patterns that match known attacks. Cloudflare notes that its network proxies over 32 million HTTP requests per second, and that WAF rules check all parts of a request, including the body, for patterns that could carry a malicious payload.
When a rule matches, the WAF records a security event so you can inspect the request later.
What is the difference between a WAF and a network firewall?
A network firewall filters traffic by IP address and port, while a WAF reads what is inside the web request itself.
A network firewall works at the network level: it sees that a packet is headed for port 443 and lets it through.
It cannot tell a real login form submission from a malicious one, because both look the same from the outside. A WAF works at the application layer, layer 7, where it can read the URL, the form fields, the cookies, and the headers.
The two are partners, not rivals. The network firewall keeps out traffic that should never reach the server at all, and the WAF catches the attacks that arrive inside normal-looking web traffic.
A WAF is not a full security plan on its own, and it works best beside other defenses such as security headers and a patched, updated site.
What attacks does a WAF block?
A WAF blocks injection attacks, cross-site scripting, and other OWASP Top 10 risks that arrive inside web requests.
The OWASP Top 10 is the standard list of the most critical web application risks, first published in 2003, and its current edition is the 2025 list, according to the OWASP Developer Guide. The ten categories are:
| Rank | Category | What it means |
|---|---|---|
| A01 | Broken Access Control | Users reach data or functions outside their permissions |
| A02 | Security Misconfiguration | Insecure defaults, settings, or exposed features |
| A03 | Software Supply Chain Failures | Compromised dependencies, builds, or updates |
| A04 | Cryptographic Failures | Weak, missing, or misused encryption |
| A05 | Injection | Untrusted input run as code or a database query |
| A06 | Insecure Design | Missing security controls at the design stage |
| A07 | Authentication Failures | Weak logins and session handling |
| A08 | Software or Data Integrity Failures | Unverified updates and data |
| A09 | Security Logging and Alerting Failures | Attacks that are never logged or noticed |
| A10 | Mishandling of Exceptional Conditions | Errors that leak data or fail open |
A WAF is strongest against injection, which covers SQL injection and cross-site scripting. A request that carries ' OR 1=1-- in a login field or a script tag in a comment matches a rule and gets blocked. Our guide to blocking bad bots covers the automated traffic that often carries these attacks.
What are the types of WAF deployment?
A WAF runs in the cloud, on your own server, or as a hardware appliance, and the choice changes who maintains it.
A cloud WAF sits in front of your site at the provider's edge. You point your DNS at the provider, and all traffic flows through its filters before it reaches your server. Cloudflare, AWS WAF, and similar services work this way, and setup takes minutes rather than days.
A host-based WAF runs as software on your own server or reverse proxy. ModSecurity is the open-source engine in this class, and the OWASP Core Rule Set is written for it. It costs little and sees deep into your application, but it uses your server's own CPU and memory.
A network-based WAF is a hardware appliance placed in front of your servers. It gives the lowest latency and full local control, but you buy, rack, patch, and scale it yourself. For most WordPress sites, the cloud option is the practical pick.
What is the OWASP Core Rule Set?
The OWASP Core Rule Set is a free, open set of generic attack detection rules that many WAFs use as their baseline.
The rule set covers the OWASP Top 10 risks with patterns for injection, cross-site scripting, and other common attacks. OWASP maintains it with Trustwave's SpiderLabs for use with the ModSecurity engine, and commercial WAFs build their own managed rules on top of the same ideas.
Cloudflare ships its own implementation, the Cloudflare OWASP Core Ruleset, as one of its managed rulesets. It is available on Pro plans and above, while the Free plan gets the smaller Free Managed Ruleset.
The Core Rule Set uses anomaly scoring: each matched rule adds to a score, and the request is blocked only when the score passes a threshold, which keeps false positives down.
The CRS docs set the default inbound threshold at 5 and the outbound threshold at 4, with a critical rule worth 5 points, and note that SQL injection alone is covered by more than 50 rules.
How much does a WAF cost?
A basic WAF costs nothing on Cloudflare's free plan, while fuller protection starts at $20 a month.
Cloudflare lists four website plans, as of November 2026: Free at $0 a month, Pro at $20 a month billed annually or $25 billed monthly, Business at $200 a month billed annually or $250 billed monthly, and Contract with custom pricing. Every plan includes a WAF, but the rules differ by plan.
| Feature | Free | Pro | Business |
|---|---|---|---|
| WAF Managed Rules | Free Managed Ruleset only | Full managed rulesets | Full managed rulesets |
| Custom rules | Yes | Yes, up to 20 | Yes |
| Rate limiting rules | One rule | Yes | Yes |
| Response custom rules | 3 | 3 | 3 |
| Leaked credentials detection | One field | Yes | Yes |
| Payload logging | No | No | No |
The figures come from Cloudflare's WAF docs, and the Pro plan allows 20 WAF custom rules, according to the Cloudflare plans page.
AWS WAF takes a different route: it bills per web ACL, per rule, and per million requests. New AWS customers get a limited free allocation for their first 12 months, according to AWS WAF pricing.
Its Bot Control add-on costs $10 a month per web ACL plus $1 per million requests at the common level. Our guide to Cloudflare Free vs Pro for WordPress compares the two Cloudflare plans in detail.
How do you check if a WAF is protecting your site?
Check the WAF dashboard for blocked requests, then test a harmless blocked pattern and confirm the block shows up.
On Cloudflare, open Security, then Security Events, where mitigated requests appear with the rule that matched them. Cloudflare says the Security Events view lets you review rule matches and tune your settings from sampled logs. If the list is empty, the WAF may be off, or your traffic may simply be clean.
The Free Managed Ruleset is deployed automatically on every new Cloudflare zone, according to the Cloudflare blog, and it covers high-profile flaws such as Log4J and Shellshock plus very common WordPress exploits.
If a real visitor gets blocked by mistake, the event log shows which rule fired, and you can set that rule to log only.
Our guide to Cloudflare WAF rules for WordPress walks through the setup.
If a security plugin locks you out instead, our Wordfence blocking guide covers the fix.
What mistakes should you avoid with a WAF?
The three big mistakes are turning the WAF off after one false positive, never reading the event log, and treating the WAF as a fix for bad code.
A false positive means one rule blocked a real visitor, and the fix is to tune that single rule, not to switch the whole WAF off.
Set the rule to log only, watch the log for a day, and then decide. The event log is also where real attacks show up, so check it weekly, not just after an incident.
A WAF cannot fix broken access control, weak passwords, or a plugin with a known flaw.
It can block the exploit attempt, which buys time, but the underlying hole stays open until you patch it. Update WordPress, your theme, and your plugins on schedule, and use the WAF as a shield while you do.
What myths about WAFs are wrong?
Three common myths are that a WAF makes a site unhackable, that only big sites need one, and that a WAF slows a site down.
No WAF makes a site unhackable. The OWASP Top 10 includes risks a WAF cannot see, such as broken access control and supply chain failures, and a logged-in attacker doing what their account allows will pass straight through. A WAF is one layer, not a full defense.
Small sites need one too. Automated bots scan every site on the internet, not just big ones, and the Cloudflare blog notes that small site owners often lack time to track fast-moving patches, which is why the Free Managed Ruleset exists.
As for speed, a cloud WAF runs at the provider's edge before traffic reaches your server, so it usually adds no delay your visitors would notice.
Frequently asked questions
Does a WAF cost money?
For most WordPress sites, no. Cloudflare includes a WAF with a Free Managed Ruleset on its free plan, and the ruleset is deployed automatically on new zones. You only pay when you want the fuller managed rulesets, which start with the Pro plan at $20 a month billed annually.
Is a WAF the same as a CDN?
A CDN speeds up a site by caching content close to visitors, while a WAF filters out attack traffic. Many providers bundle both, and Cloudflare includes both on every plan. You can run a CDN without a WAF, but a WAF on its own still needs the site behind it to serve pages.
Does a WAF replace a security plugin?
No. A security plugin runs inside WordPress and can protect logins, scan files, and block users, while a WAF filters traffic before it reaches the server. The two work well together, and a WAF never replaces keeping plugins and WordPress itself updated.
What should I do if my WAF blocks a real visitor?
First, check the WAF event log to see which rule blocked the request. Then set that rule to log only, or add an exception for the blocked path, and watch the log for a day before you decide. Never switch the whole WAF off because of one false positive.
Can I use a WAF with WordPress?
Yes. A WAF sits in front of the site and filters HTTP traffic, so it works with WordPress, WooCommerce, and any other web application. Cloudflare's Free Managed Ruleset even includes rules for very common WordPress exploits.
Does a WAF fix vulnerabilities in my site?
No. A WAF blocks attacks that arrive inside web requests, but it cannot fix broken access control, weak passwords, or a plugin with a known flaw. It buys time by blocking the exploit attempt while you patch the underlying hole.
Sources
- Cloudflare Web Application Firewall Cloudflare
- WAF for everyone: protecting the web from high severity vulnerabilities Cloudflare
- Pricing Cloudflare
- OWASP Top 10 OWASP
- Anomaly Scoring OWASP Core Rule Set
- AWS WAF Pricing Amazon Web Services
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


