WAF and DDoS layers
Different controls solve different problems
A web application firewall (WAF) evaluates application-level HTTP traffic against policy. A network firewall controls reachability. A rate limiter bounds accepted work by a chosen identity. A distributed denial of service (DDoS) event can overwhelm network bandwidth or application capacity. Nginx request controls help manage application work, but cannot recover bandwidth already saturated before requests arrive. Design network protection with a provider that can absorb or filter traffic upstream. The following diagram is an architecture sketch, not a product configuration.
Clients → provider network protection → CDN / WAF → restricted origin Nginx → application network capacity HTTP policy local budgets authorizationNative Nginx limits are not a WAF
Use rate limits for fairness and capacity protection, and keep authentication at the application. The example uses a shared zone for the effective client IP. Start with dry-run mode to observe rejected or delayed candidates without enforcing the rate limit; then approve an enforcement change based on real legitimate traffic. A 429 is a deliberate overload response here, not evidence of malicious intent. This http-context fragment assumes a reviewed client identity and an existing static document root. The rates are illustrative, not production recommendations.
limit_req_zone $binary_remote_addr zone=public_budget:1m rate=10r/s;server { listen 127.0.0.1:19106; server_name edge.test; root /srv/demo/public; location / { limit_req zone=public_budget burst=5; limit_req_dry_run on; limit_req_status 429; try_files $uri =404; }}Select an actual WAF integration
F5 WAF for NGINX (formerly NGINX App Protect WAF) is a separate commercial product with its own deployment and entitlement requirements; ordinary Nginx does not supply its directives. OWASP ModSecurity v3 has a separate Nginx connector and a rule engine; the engine license is Apache 2.0, but check connector and rule-set licenses and compatible releases separately. A ruleset such as OWASP CRS is not identical to the engine. A managed edge WAF is another option, with provider-specific policy and billing. The following F5-specific fragment illustrates enabling a policy only in a supported, licensed installation with the policy file present; it is not used in the OSS lab.
app_protect_enable on;app_protect_policy_file /etc/app_protect/conf/NginxDefaultPolicy.json;Detection, blocking and inspection limits
Detection records decisions without denying ordinary requests; blocking enforces selected decisions. In F5 transparent mode violations do not block on the basis of the policy. Policy behavior under engine failure, oversized bodies, unsupported content types and partial inspection must be checked for the exact release. A legitimate large upload can look suspicious or exceed an inspection limit. Do not disable controls globally to fix one false positive. Review an approved endpoint-specific exception, test normal use and retain an expiration and owner. The following is an inert decision record, not a deployable WAF policy.
{ "endpoint": "/catalog", "mode": "observe", "decision": "review", "reason": "synthetic body-limit event", "owner": "application-team"}Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
WAF and DDoS layers
Distinguish WAF policy, rate controls and provider-level DDoS defenses and choose a suitable integration.
Which layer can help when the link to the origin is already saturated?
What does a native rate limiter control?
What does transparent WAF policy mode do?
Which component connects Nginx to libmodsecurity v3?
How should a false positive be addressed?