What Is a Web Application Firewall (WAF)?
How a web application firewall filters malicious requests, server-level versus cloud WAFs, what they catch and miss, the false positives to expect, and how to handle a blocked legitimate request.

Table of Contents
A web application firewall (WAF) inspects incoming web requests and blocks those that look like attacks before they reach your website: for example SQL injection attempts, cross-site scripting payloads, attempts to exploit known plugin vulnerabilities, and abusive bots. Unlike a network firewall, which allows or blocks connections by port and address, a WAF understands HTTP requests and their content.
A WAF is a valuable layer, not a substitute for updating software and writing secure code.
Network firewall vs WAF
| Network firewall | Web application firewall | |
|---|---|---|
| Works on | IP addresses, ports, protocols | HTTP requests: URLs, headers, parameters, bodies |
| Stops | Unwanted connections to closed services | Malicious web requests to an open website |
| Example | "Only allow ports 80 and 443" | "Block requests containing SQL injection patterns" |
You need both: the network firewall closes everything except the web ports; the WAF filters what arrives on them. See Linux firewall basics.
Where a WAF can run
On the server
Modules such as ModSecurity run inside or alongside the web server, usually with a ruleset such as the OWASP Core Rule Set (CRS) or a commercial ruleset. Many hosting providers enable a server WAF for all accounts.
In a CMS plugin
Some security plugins include an application-level firewall. It runs inside the application, so it understands the CMS well, but it uses the server's resources and only works once PHP is running.
In the cloud (at the edge)
A reverse proxy or CDN service filters traffic before it reaches your server. It can also absorb large floods and hide your origin IP. See DDoS attacks explained.
What a WAF catches well
- Common injection and cross-site scripting attempts.
- Known exploit patterns for popular CMSs and plugins (virtual patching).
- Malicious bots and scanners.
- Request floods to specific URLs, with rate-limiting rules.
- Requests with obviously malformed or oversized content.
What a WAF can miss
- Flaws in your own business logic, such as a user being able to view another user's order by changing an ID. See OWASP Top 10 explained.
- Attacks using stolen valid credentials.
- New attack techniques not yet covered by rules.
- Attacks that bypass the WAF by reaching the origin server directly, if the origin is not restricted.
False positives
A WAF sometimes blocks legitimate actions, especially:
- saving content that contains code snippets or unusual characters;
- form submissions with long or complex text;
- admin actions in page builders or e-commerce plugins.
You usually see a 403 Forbidden error. The fix is not to switch the WAF off entirely, but to find the rule ID (in the error page, logs or your host's tools) and create a targeted exception for that rule on that specific URL. On hosted servers, send the rule ID, URL and time to your host's support. See common hosting errors.
Tuning a WAF
- Start in detection/logging mode where possible, review what would be blocked, then enable blocking.
- Keep rulesets updated.
- Use rate limits on login, search and API endpoints.
- Review logs regularly for patterns and false positives.
Example: a false positive and how to fix it properly
An editor tries to save a blog post containing a code snippet (SELECT * FROM users WHERE id = 1) and gets a 403 Forbidden error. The steps:
- Note the exact time and the URL of the request (for example
/wp-admin/post.php). - Look for the WAF's message: the error page or the server's ModSecurity log usually includes a rule ID (for example a SQL-injection rule from the OWASP Core Rule Set).
- Confirm the cause: the rule matched SQL keywords in the post content, which is legitimate here.
- Fix narrowly: create an exception that disables that rule only for that URL (or for authenticated admin requests), rather than disabling the WAF for the whole site. On shared hosting, send the rule ID, URL and time to support.
- Test: save the post again, and confirm that a genuinely malicious request to a public page is still blocked.
Narrow exceptions keep protection in place everywhere else.
Choosing between server, plugin and cloud WAFs
| Consideration | Server WAF | Plugin WAF | Cloud/edge WAF |
|---|---|---|---|
| Who manages rules | Host or you | Plugin vendor | Provider |
| Uses your server's resources | Some | Yes, runs in PHP | No |
| Protects against floods | Limited | No | Yes, absorbs traffic upstream |
| Understands your CMS | Generic rules | Often CMS-specific | Managed rule sets, some CMS-aware |
| Requires DNS changes | No | No | Usually yes (proxy) |
Many small sites rely on their host's server WAF plus a lightweight security plugin; busier or frequently targeted sites add an edge WAF.
Frequently Asked Questions
Do I need a WAF if I keep my software updated?
Updates are the foundation. A WAF adds protection for the window between a vulnerability becoming known and your update, and filters noise and abuse.
Does a WAF slow my site down?
Well-implemented WAFs add little latency. Edge WAFs can even improve performance through caching and filtering.
Can I have more than one WAF?
Yes, for example an edge WAF plus a server WAF, but layered rules make troubleshooting false positives more complex.
Related reading
A WAF is one protective layer in website security basics. For busier sites that need more resources than shared hosting, see ServerNeed cloud hosting.
Sources
Last updated 7 October 2026



