How is a WAF different from a network firewall?
A network firewall decides whether a connection to port 443 may happen at all. Once it is allowed, everything inside the session looks the same to it. A WAF works one level higher: it sees the decrypted method, path, query string, headers, cookies and body of each request, and it can tell a normal search query from one that carries ' OR 1=1 --. The two complement each other. The firewall shrinks what can be reached; the WAF checks what reachable services are asked to do. Firewall covers the lower layer.
Which attacks does a WAF catch?
- Injection: SQL, command and template injection strings in parameters.
- Cross-site scripting: script tags and event handlers smuggled into fields that will be shown to other users.
- Path traversal and file inclusion: sequences like
../../etc/passwdor remote URLs passed as file names. - Protocol abuse: malformed headers, oversized bodies, request smuggling tricks.
- Scanner noise: known vulnerability probes for admin panels and outdated plugins.
- Rate-based abuse: login brute force and scraping, when the WAF also enforces request limits.
It does not fix the underlying bug. A WAF buys time between the day a flaw is known and the day you patch it, and blocks the background noise every public site receives.
How do rule sets and paranoia levels work?
The most widely used free ruleset is the OWASP Core Rule Set. Instead of blocking on the first suspicious sign, it gives each request an anomaly score: every matching rule adds points, and only requests above a threshold are blocked. Paranoia levels from 1 to 4 decide how many rules are active. Level 1 catches obvious attacks with few false alarms and suits most sites. Higher levels catch cleverer payloads but also flag ordinary content such as code snippets in a forum post, so they need exclusions for each application.
How do I run a WAF in front of my site?
ModSecurity v3 with the nginx connector, or Coraza, its Go-based successor, both load the Core Rule Set. On Debian or Ubuntu with Apache the quickest route is the packaged module:
apt install -y libapache2-mod-security2 modsecurity-crs cp /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf sed -i 's/^SecRuleEngine .*/SecRuleEngine DetectionOnly/' /etc/modsecurity/modsecurity.conf a2enmod security2 && systemctl reload apache2 tail -f /var/log/apache2/modsec_audit.log
Leave it in detection mode for a week of real traffic, write exclusions for the false positives you find, then switch the engine to On. With nginx as the reverse proxy, the same rules can protect any backend, whether PHP, Node or Python; Reverse Proxy shows where the WAF sits in that chain.
How do I handle false positives without weakening everything?
Narrow every exception. Instead of turning off a rule globally, disable it for one parameter on one path, for example allowing HTML in the body field of /admin/posts only. The audit log records the rule ID, the matched variable and the anomaly score for each blocked request, which is exactly what you need to write that exclusion. Review exclusions when the application changes; an exception for a field that no longer exists is just a gap.
Which requests should never reach the rules at all?
Static files are the easy win. Images, fonts, scripts and stylesheets served straight from disk carry no user input worth scoring, so exclude those locations from inspection and save the CPU for dynamic endpoints. Health checks from your own monitoring can be skipped too, as long as they come from a fixed address. Large uploads deserve a size cap in the web server before the WAF reads them, otherwise one multi-gigabyte body can tie up memory while it is buffered for inspection.
Hosted WAF or self-hosted?
A hosted WAF runs at a provider's edge as part of a proxy or CDN: there is nothing to install, it absorbs some bot traffic before it reaches you, and the rules are maintained for you. A self-hosted WAF on your own reverse proxy keeps request data on your machine, costs nothing beyond CPU, and lets you write rules that know your app. Many teams use both: a hosted layer for bulk bot filtering and a local ruleset tuned to their own endpoints. If you go hosted, restrict the origin so traffic cannot skip it, as described on CDN.
What does a WAF cost in hardware?
Rule evaluation is CPU work per request, and body inspection adds memory per concurrent upload. A typical small shop with a few hundred requests per second barely notices it on the S2 (6 cores). High-traffic APIs that inspect JSON bodies benefit from more cores, such as the S11 with 24 cores and 32 threads.
Machines for a Site With Its Own WAF
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| S2 | Intel Xeon E-2356G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $58.39 | $58.39 (1 month) |
| S4 | Intel Xeon E-2388G | 8 / 16 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $87.52 | $87.52 (1 month) |
| S11 | Intel Core i9-14900K | 24 / 32 | 128 GB DDR5 | 2x 2 TB NVMe | 2x 10 Gbps | $149.39 | $149.39 (1 month) |
| S13 | AMD EPYC 4345P | 8 / 16 | 128 GB DDR5 | 2x 2 TB NVMe | 2x 25 Gbps | $237.92 | $237.92 (1 month) |
Keep Reading
Reverse Proxy
The server that sits in front of your applications, terminating TLS, routing by hostname and balancing load, with a working nginx example.
OpenFirewall
What a firewall does, packet filters versus stateful and application firewalls, and the Linux tools that set the rules on a dedicated machine.
OpenNext-Generation Firewall
Firewalls that look past ports to applications, users and threats, what NGFW features really do, and the open source pieces that cover them.
OpenOnline stores
WooCommerce, Magento or a headless shop on a box sized for catalog size, checkout load and sale-day peaks.
OpenFAQ
Quick Answers
Attacks carried inside HTTP requests, such as SQL injection, cross-site scripting, path traversal and known vulnerability probes.
No. It blocks many exploit attempts and buys time, but the vulnerable code still needs to be fixed.
A free, widely used set of WAF rules that scores requests for attack patterns and blocks those above a threshold.
A rule matched harmless content. Use the audit log to find the rule ID and add a narrow exclusion for that parameter and path.
Yes. ModSecurity or Coraza on your web server or reverse proxy works on any of our Linux images.