Web application firewalls explained: what a WAF does for a small website
A web application firewall filters requests before they reach your site. What it catches, what it misses, and how to check whether your plan already includes one.
Somewhere between your visitors and your website, you can place a filter that inspects requests before they reach your code. That filter is a web application firewall, or WAF. This guide explains what a WAF actually does, the three ways to run one, and the limits that matter before you rely on it - grounded in Cloudflare's learning materials and the OWASP Core Rule Set project.
What a WAF is
A WAF filters and monitors HTTP traffic between a web application and the internet. It works at layer 7, the application layer, which means it reads the content of requests - URLs, form fields, headers - rather than just network addresses. Cloudflare describes it as a kind of reverse proxy: visitors pass through the WAF before reaching your server, so the server is shielded from direct exposure. The filtering runs on a set of rules, often called policies, that describe what malicious traffic looks like. One practical benefit of that design is speed: rules can be updated quickly when a new attack appears, and during a DDoS attack, rate limiting can be added by changing policy rather than changing your application.
Blocklists, allowlists and the rules themselves
WAFs come in two classic postures. A blocklist (negative security model) lets traffic through unless it matches a known-bad pattern; an allowlist (positive security model) admits only pre-approved traffic. Many WAFs blend the two. You do not have to write the rules yourself: the OWASP Core Rule Set (CRS) is a free set of generic attack detection rules for ModSecurity and compatible WAFs, licensed under Apache 2.0, that aims to cover the OWASP Top Ten categories - SQL injection, cross-site scripting, local file inclusion and more - with a minimum of false alerts.
What a WAF does not do
Two limits deserve emphasis. First, a WAF is not designed to defend against all types of attacks: it is one layer in a broader defense, and it does not fix vulnerable code, weak passwords or missing updates - those remain your job. Second, filters guess wrong in both directions. Rules tuned too loosely let attacks through; tuned too tightly, they block real customers - for example a form that rejects an unusual but valid entry, or a checkout that flags a real customer. The OWASP CRS project explicitly tracks false alerts as a quality metric, which tells you the problem is real even in a well-maintained ruleset. Expect to review what your WAF blocks, especially after turning it on.
Three ways to run one
Cloudflare groups WAF deployments into three shapes, each with a different bill:
- Network-based - hardware on your own network. Low latency because it sits locally, but the most expensive option and you maintain physical equipment.
- Host-based - software integrated into your application stack. Cheaper than hardware and more customizable, but it consumes your server's resources and takes engineering time to run well.
- Cloud-based - a service in front of your site, often turned on with a DNS change and paid as a subscription. Easy to start, updated by the provider; the trade-off is handing inspection to a third party, whose rules may be a black box to you.
Does a small site need one?
Start by checking what you already have: hosting providers, CDNs and website platforms sometimes bundle a managed WAF or an optional security add-on, so the first step may be enabling and configuring something already in your plan rather than buying anything. If you turn one on, plan the first weeks as a tuning period: watch what gets blocked, test your own forms and checkout, and adjust. And keep the basics going either way - updates, strong logins, backups - because a WAF complements those habits rather than replacing them.
FAQ
Does a WAF replace software updates?
No. A WAF can block requests that exploit known vulnerability patterns, but it is not designed to defend against all attack types, and new or unusual attacks can slip past rules. Updating your software removes the underlying weakness; a WAF only helps screen the traffic that reaches it.
Are there free WAF options?
Yes, in part. The OWASP Core Rule Set is a free, open-source ruleset for ModSecurity and compatible engines, so the rules themselves cost nothing - you still need somewhere to run them, and some hosts or CDNs bundle managed rules into existing plans. Check what your current provider includes before paying for a separate service.
Will a WAF block real visitors?
It can, when rules misfire - this is the false-positive problem, and even the OWASP CRS, which is tuned to minimize false alerts, tracks them as an ongoing concern. The practical answer is to monitor blocked requests after enabling a WAF and adjust the rules, rather than assuming every block was an attack.
Is a WAF the same as a network firewall?
No. A traditional network firewall filters by addresses, ports and protocols at lower network layers; a WAF works at the application layer and reads the content of web requests, which is what lets it spot patterns like SQL injection in a form field. The two answer different questions and can coexist.