Sem Agente · Sem Instalação

WAF & CDN: The Guide to Amplify Your Security

WAF and CDN: When It Makes Sense, Which Ones Exist, How to Choose An honest guide to the two most misunderstood technologies in web security — and why so many companies use them wrong, overspend, or remain unprotected even with both in place.

WAF and CDN: When It Makes Sense, Which Ones Exist, How to Choose

An honest guide to the two most misunderstood technologies in web security — and why so many companies use them wrong, overspend, or remain unprotected even with both in place.

Introduction

If you've gone through the recent posts in this series hardening web servers, configuring email authentication, protecting certificates, and closing ports, you've probably thought: "all this is great, but what if I put a CDN with WAF in front? Wouldn't that solve 80% of the problems at once?"

The honest answer is: sort of. CDN and WAF are powerful tools that solve real problems, but they're also frequently used as a magical bandage that makes everyone sleep soundly while fundamental problems remain untouched.

Worse: many people use WAF thinking they're protected when they're actually in "monitor only" mode for two years, or have rules so generic they block legitimate customers while letting real attacks through.

Part 1: What a CDN is, really

CDN — Content Delivery Network. The original idea from the 1990s: spread copies of content on servers around the world. By 2026, CDNs have evolved to do much more.

1.1 What a modern CDN does

  1. Static content caching — images, CSS, JS, fonts, videos closer to the user
  2. Dynamic acceleration — route optimization even for changing content
  3. TLS termination — certificate managed by the CDN
  4. Volumetric DDoS protection — absorbs attacks of hundreds of Gbps
  5. Bot management — detects and mitigates malicious bots
  6. Built-in WAF — practically all modern CDNs have one
  7. Edge compute — Cloudflare Workers, Lambda@Edge, Fastly Compute, etc.
  8. Image/video optimization — WebP/AVIF, adaptive transcoding
  9. Analytics and observability
  10. Failover and load balancing

1.2 What a CDN does NOT do

  • Doesn't fix your application — slow PHP stays slow
  • Doesn't replace backup — cache is not permanent storage
  • Doesn't hide your origin by default — real IP remains discoverable
  • Doesn't protect against attacks that look legitimate — slow brute force, account takeover
  • Doesn't replace hardening — wrong configurations stay wrong
  • Doesn't work magic on 100% dynamic content — checkout, authenticated dashboards

Part 2: What a WAF is, really

WAF — Web Application Firewall. Unlike traditional firewalls (layers 3-4), it operates at layer 7 — understands HTTP, knows web application semantics, decides based on content.

2.1 What a WAF does

It intercepts every HTTP request and asks:

  • Does this parameter have SQL injection patterns?
  • Is this User-Agent from a scanner?
  • Is this IP on a bad reputation list?
  • Does this URL try to access wp-config.php?
  • Does this request have XSS patterns?
  • Is this client making 500 req/s (rate limit)?
  • Does this request match a known exploit (Log4Shell, ProxyShell)?

If yes: it blocks, challenges (CAPTCHA), logs, or flags.

2.2 Rule types

Negative security model (blacklist): "Everything allowed, except this." Standard for most. ModSecurity + OWASP CRS is the classic example. Works out-of-the-box, generates false positives.

Positive security model (whitelist): "Only allowed what matches this." Much safer, exhausting to maintain. Almost nobody does pure whitelist.

Behavioral analysis and ML: Modern WAFs detect anomalies. "This IP usually does 10 req/min, now 1000" → action. Black box, hard to debug.

2.3 OWASP Top 10 — what WAF really protects

Good protection:

  • Basic/medium SQL injection
  • Basic reflected/stored XSS
  • Path traversal
  • Webshell upload
  • Known exploits with signatures
  • Gross brute force
  • Scrapers and scanners

Partial protection:

  • Broken access control (logic)
  • Insecure deserialization
  • Sophisticated XSS with encoding
  • SSRF
  • XXE

Does not protect:

  • Business logic (negative price, race condition)
  • Account takeover via valid credentials
  • User phishing
  • Insider threats

WAF is a defense layer, not the defense. It buys time, blocks noise, protects against common attacks. Doesn't replace a secure application.

Part 3: Why CDN and WAF appear together

  1. Same architectural position — both need to be in front
  2. Performance — inspecting HTTP at the PoP is faster
  3. Data synergy — collective intelligence among customers
  4. Volumetric DDoS only mitigates at scale — CDNs already have the network
  5. Business model — CDNs sell WAF as upsell
  6. Operational simplification — one solution instead of three

In 2026, "I'm going to put a CDN" generally means "I'm going to put CDN + WAF + DDoS + bot management + rate limiting". The lines blurred.

Part 4: The main CDN providers

4.1 Cloudflare

The default choice. PoPs in 300+ cities, generous free plan.

Strengths:

  • Robust free plan (CDN + DNS + DDoS + SSL)
  • Exceptional global performance
  • Huge ecosystem (Workers, R2, D1, Stream)
  • Cloudflare Tunnel (hides origin completely)
  • Authenticated Origin Pulls (mTLS with origin)
  • Cloudflare Access (ZTNA) integrated

Weaknesses:

  • Advanced WAF only in paid plans
  • Enterprise is expensive
  • Concerning centralization

Plans:

  • Free — CDN, DNS, SSL, basic DDoS
  • Pro ($25/month) — managed WAF, image optimization
  • Business ($250/month) — full WAF, custom certificates
  • Enterprise — upon request

For whom: practically everyone. Hard to go wrong.

4.2 AWS CloudFront + AWS WAF

Strengths:

  • Deep integration with AWS
  • Pay-as-you-go
  • Lambda@Edge and CloudFront Functions
  • AWS Shield integrated
  • 600+ PoPs

Weaknesses:

  • More complex configuration
  • No comparable free tier
  • AWS WAF charges per rule and per request

For whom: those already in AWS.

4.3 Akamai

The oldest. 4,000+ PoPs.

Strengths:

  • Probably the largest network in the world
  • Brutal global performance
  • Bot Manager and Kona Site Defender very robust
  • History with sophisticated attacks

Weaknesses:

  • Expensive, very expensive
  • No self-service
  • Requires expertise

For whom: large companies, financial, government.

4.4 Fastly

Known for speed and VCL.

Strengths:

  • Exceptional performance
  • VCL for advanced customization
  • Compute@Edge (Rust, JS, Go, Python)
  • Fastly Next-Gen WAF (Signal Sciences) highly respected

Weaknesses:

  • More expensive than Cloudflare
  • Famous outage history (June 2021)
  • VCL learning curve

For whom: publishers, media, high-volume e-commerce.

4.5 Bunny.net

European alternative that grew quickly.

Strengths:

  • Very competitive pricing (10x cheaper in some scenarios)
  • Simple interface
  • Good global performance
  • Bunny Optimizer for images

Weaknesses:

  • More limited WAF
  • Smaller ecosystem
  • No robust edge compute

For whom: SMEs that want good, cheap CDN without complications.

4.6 Google Cloud CDN

Strengths:

  • Integration with GCP
  • Google Cloud Armor (WAF + DDoS)
  • Google infrastructure

Weaknesses:

  • No simple self-service
  • More GCP-user focused

For whom: those already in GCP.

4.7 Azure CDN + Azure Front Door

Strengths:

  • Native integration with Azure
  • Azure WAF integrated
  • Good for hybrid scenarios

Weaknesses:

  • History of product changes
  • Azure learning curve

For whom: Microsoft-heavy organizations.

4.8 Others

  • CDN77 — European alternative
  • KeyCDN — simple and cheap
  • StackPath — focused on edge compute
  • CDNetworks — strong in Asia
  • EdgeCast / Edgio — in restructuring

Part 5: The main WAFs

5.1 Cloud WAFs (separate from CDNs)

  • Imperva — mature, enterprise, financial, expensive
  • F5 Distributed Cloud — flexible, enterprise
  • Barracuda WAF-as-a-Service — good balance
  • Sucuri — focused on WordPress + malware removal

5.2 Open-source WAFs

ModSecurity — the most known. Apache/Nginx/IIS module. Combined with OWASP Core Rule Set it's the de facto standard in self-hosted. Mature (20+ years), free, complex, generates false positives.

Coraza — modern fork in Go. Faster, better integration with modern proxies (Caddy, Traefik). Compatible with ModSecurity rules. Growing trend.

NAXSI — lightweight for Nginx, whitelist. Fewer false positives, requires learning.

OpenAppSec — uses machine learning, Check Point project with community version.

5.3 On-premise/appliance WAFs

  • F5 BIG-IP Advanced WAF — reference, extremely expensive
  • Fortinet FortiWeb — good value
  • Imperva SecureSphere WAF — on-prem version
  • Barracuda Web Application Firewall
  • Citrix Web App Firewall

5.4 Comparison

| Solution | Type | Cost | Complexity | For whom | |---|---|---|---|---| | Cloudflare WAF | Cloud (CDN) | $ to $$ | Low | Practically everyone | | AWS WAF | Cloud (CDN) | $ to $$ | Medium-High | AWS users | | Akamai Kona | Cloud (CDN) | $$ | High | Enterprise | | Fastly NGWAF | Cloud (CDN) | $$ | Medium | Technical companies | | Imperva | Separate cloud | $$ | High | Enterprise | | ModSecurity + CRS | Open-source | Free | High | Self-hosted | | Coraza | Open-source | Free | Medium | Modern self-hosted | | FortiWeb | Appliance | $$ | Medium | Datacenter |

Part 6: When to use (and when not)

6.1 CDN makes sense when

  • Geographically distributed audience
  • Site with lots of static content
  • Unpredictable traffic spikes
  • Limited origin server
  • Needs DDoS protection
  • Wants managed TLS termination
  • Wants to hide the origin

6.2 CDN makes less sense when

  • 100% dynamic and authenticated application
  • Exclusively local audience
  • Very low volume
  • Compliance prohibits third parties in the path
  • Development and debugging

6.3 WAF makes sense when

  • Web application exposed on the internet (any)
  • Application with user inputs
  • Popular CMS (WordPress, Drupal, Magento)
  • Public API
  • Compliance requires it (PCI-DSS)
  • Visible company, known target
  • Known vulnerability without patch yet (virtual patching)

6.4 WAF makes less sense when

  • Purely backend application, not exposed
  • Microservices with mTLS between them
  • Nobody to tune and monitor it
  • Unusual traffic patterns (gaming, streaming)

6.5 WAF without CDN

Possible but rare. ModSecurity directly in Nginx/Apache. Makes sense when compliance prohibits third parties, full control matters, low traffic, cost is critical. Disadvantage: no volumetric protection, HTTP inspection on the server itself.

Part 7: How to choose

7.1 By profile

Institutional site/blog: Cloudflare Free.

Small-medium e-commerce: Cloudflare Pro/Business.

Large e-commerce: Cloudflare Business/Enterprise, Fastly or Akamai.

B2B SaaS: Cloudflare Pro/Business or AWS CloudFront + WAF (if in AWS).

High-volume public API: Cloudflare Business+ or AWS WAF.

Financial/banking: Akamai, Imperva or Cloudflare Enterprise. Consider on-premise for regulated environments.

Media/publisher: Fastly or Cloudflare.

WordPress: Sucuri or Cloudflare.

Self-hosted, data sovereignty: Nginx + ModSecurity + OWASP CRS, or Coraza.

Microsoft-heavy on Azure: Azure Front Door + Azure WAF.

Multi-customer MSP: Cloudflare or AWS WAF.

7.2 Evaluation criteria

  • Global performance for your audience — WebPageTest, GTmetrix, Cloudflare Radar
  • Attack coverage — managed rules, updates, OWASP CRS, custom rules, ML
  • Pricing model — per GB, requests, features, fixed plan
  • Learning curve
  • Integration with your stack — API, Terraform, GitOps, CI/CD
  • Logs and observability — format, destination
  • Support — SLA, 24/7, language
  • Vendor lock-in

7.3 PoC before deciding

  1. List 3 candidates
  2. Configure test subdomain on each
  3. Run real or synthetic traffic for 1-2 weeks
  4. Measure performance, false positives, operation, actual cost
  5. Compare and decide

Part 8: Common mistakes

8.1 WAF in "monitor only" forever

You activate in log-only mode and never switch to blocking. You have all the logs in the world, zero real protection. Set a deadline: 30 days to blocking mode.

8.2 Origin still exposed

CDN in front, but attacker discovers the real IP (crt.sh, DNS history, scans) and bypasses everything. Solution: IP restriction or mTLS (Authenticated Origin Pulls).

8.3 Rules too generic or too specific

Generic ones block legitimate traffic. Specific ones miss variations. Start with managed rules, adjust only where necessary.

8.4 Don't monitor the WAF

You configure it and never look. Sophisticated attack passes, legitimate customer gets blocked, you only find out when they call.

8.5 Trust WAF 100%

"Compliance security" — install to pass PCI-DSS and think you're protected. WAF is a layer, not the only one.

8.6 Don't test before production

Straight to prod = recipe for disaster. Always staging first, gradual rollout.

8.7 Forget to update rules

ModSecurity with outdated OWASP CRS is partially blind. Automate updates.

8.8 Cache private dynamic content

CDN caching page with another user's session and serving to everyone. Massive data leak. Always Cache-Control: private or no-store on sensitive content.

8.9 Don't integrate with other tools

WAF logs separate from SIEM, alerts separate. Incidents slip through. Integration from day 1.

8.10 Underestimate costs

Free → Pro → Business → Enterprise. Model cost with projected traffic. Have billing alerts. Black Friday can generate unexpected bills.

Part 9: Integration with security stack

  • SIEM — WAF logs to Splunk, Elastic, Wazuh, Datadog
  • Observability — metrics in Grafana, Datadog
  • SOAR/automation — Cortex XSOAR, Splunk SOAR
  • Identity provider — Cloudflare Access integrating with Okta, Azure AD
  • Continuous scanning — SentinelHub detects presence and configuration of WAF/CDN, alerts on changes
  • Vulnerability management — WAF as virtual patch
  • Incident management — clear runbooks for false positives

Final checklist

DECISION AND PLANNING
[ ] Evaluated if you need CDN
[ ] Evaluated if you need WAF
[ ] Modeled cost with projected traffic
[ ] Compared 2-3 candidates
[ ] PoC with real traffic

CDN
[ ] DNS pointing to CDN
[ ] Origin with mTLS or IP whitelist
[ ] Cache configured correctly
[ ] Origin HTTPS enabled
[ ] Compression (Brotli/gzip)
[ ] HTTP/2 and HTTP/3
[ ] Image optimization (if applicable)

WAF
[ ] Managed rules enabled
[ ] Blocking mode (not monitor forever)
[ ] False positives adjusted
[ ] Custom rules for app patterns
[ ] Rate limiting on sensitive endpoints
[ ] Bot management active
[ ] Geo-blocking where it makes sense

OPERATION
[ ] Logs centralized in SIEM
[ ] Monitoring dashboards
[ ] Alerts for anomalies
[ ] Documented runbooks
[ ] Team trained
[ ] Emergency procedure
[ ] Periodic rule review
[ ] Automated updates

DEFENSE IN DEPTH
[ ] Origin hardening up to date
[ ] Patches applied
[ ] Application still secure (SAST/DAST)
[ ] External continuous monitoring
[ ] Independent backup
[ ] Fallback plan if CDN goes down

Final thoughts

WAF and CDN are powerful tools that solve real problems. But they're not a magical bandage. Companies that put Cloudflare in front and stop thinking about security are just as vulnerable as before — they just don't realize it.

Analogy: WAF/CDN is like hiring private security for your store. It's important, adds real value. But if the back door is open, if the safe has no lock, if employees have weak passwords — private security doesn't solve it. It's a layer. Not the only one.

The good news: CDN and WAF are more accessible than ever. Cloudflare Free protects most SMEs with minutes of configuration. Bunny.net offers excellent CDN at rock-bottom prices. ModSecurity is free and mature. There's no excuse anymore for not having at least an initial layer.

The bad news: choosing wrong, configuring wrong, or forgetting to monitor gives a false sense of security that's worse than conscious insecurity.

SentinelHub sweeps exactly this ecosystem: automatically detects which CDN/WAF is protecting your domains (Cloudflare, AWS, Akamai, Imperva, Sucuri, Fortinet, F5, and 30+ more providers), validates that the WAF is active (not just present), tests with benign payloads to confirm blocking, identifies if origin is directly exposed, monitors TLS certificates, and alerts when something changes. Because putting the CDN up is the beginning — keeping it working properly every day is the real job.