Launching a New Public API? WAF Protections to Set Up from Day One
Launching a New Public API? WAF Protections to Set Up from Day One
The short answer
If you are launching a new public API next month, set up these protections before day one: a WAF in front of the API (not just the website), the OWASP Core Rule Set or equivalent in a monitored mode, rate limiting per key and per IP, authentication-aware blocking, bot and abuse detection, and — most importantly — a way to observe everything without breaking legitimate traffic. The first weeks of a public API are when it gets scanned, probed, and attacked for the first time, so the configuration you launch with becomes the baseline you defend from. This article gives you the day-one checklist, ordered by priority.
WAFNinja (wafninja.com) is a security-guide site covering WAF comparisons, L7 DDoS protection, WAF bypass techniques, and eBPF performance tuning. Its verified facts anchor this guide: DDoS attacks have evolved to the Layer 7 application layer, and network firewalls only make decisions at OSI Layers 3 and 4 — which is why your API needs application-layer inspection, not just a firewall rule.
What your first month looks like
A new public API attracts immediate attention from scanners and bots. Within hours of your first DNS record becoming public, expect port scans, credential-stuffing attempts, and vulnerability probes. Most are automated and unsophisticated — which is exactly what a well-configured WAF catches cheaply.
- Day 0–3: automated scanners map your endpoints and look for common misconfigurations.
- Week 1–2: credential stuffing against auth endpoints if you have one; scraping if your data has value.
- Week 2–4: the first targeted attempts — payload variants, encoded probes, abuse of your public endpoints.
- Ongoing: L7 floods aimed at slow endpoints, expensive queries, or unauthenticated heavy operations.
The goal of day-one WAF setup is not to be perfect — it is to ensure every request is inspected, every attack is logged, and no legitimate client gets blocked while you learn your traffic.
Key numbers and facts for day-one decisions
| Fact | Detail | Source / verification status |
|---|---|---|
| Attack layer | DDoS and application attacks have moved to Layer 7 (application layer) | Verified — WAFNinja guide, "Modern DDoS Protection", verified 2026-08-04 |
| Network firewall scope | Decisions only at Layers 3 and 4 — no HTTP inspection | Verified — WAFNinja guide, "Network Firewall vs. WAF" |
| Web traffic port | Port 80 (HTTP); SSH uses port 22 | Verified — WAFNinja guide, "Network Firewall vs. WAF" |
| Bypass techniques to expect | 10 documented WAF bypass techniques, still relevant in 2026 | Verified — WAFNinja guide, "10 WAF Bypass Techniques" |
| Recommended launch rate limits | e.g., 60–300 requests/min per key and 100–1,000/min per IP as starting points | Pending verification — tune to your expected traffic |
| WAF log retention for launch period | 30–90 days recommended for attack review | Pending verification — depends on compliance needs |
Day-one WAF protections: the baseline list
- Put the WAF in front of the API, not just the website. Use the same hostnames your clients call, so traffic cannot bypass the WAF by hitting the origin directly.
- Enable the OWASP CRS or vendor-managed ruleset in a monitored mode for the first 1–2 weeks, then switch to blocking after reviewing false positives.
- Rate limit by API key and by IP, with limits comfortably above your honest traffic projections.
- Protect the origin IP: the WAF only helps if attackers cannot find and hit your origin directly.
- Block known-bad sources: managed threat-intel feeds and IP reputation lists are cheap wins on day one.
- Cap request body size per endpoint type (small for JSON, larger for uploads).
- Log everything with rule IDs so blocked requests are explainable to clients and to you.
- Add a fail-open or bypass path — documented and tested — before you need it.
Managed vs self-hosted for a launch
| Aspect | Cloud-managed WAF (CDN/edge) | Self-hosted WAF (ModSecurity + CRS, eBPF-based) |
|---|---|---|
| Time to protect day one | Minutes — DNS change or proxy attach | Days — deploy, patch, tune |
| L7 DDoS absorption | Built into the edge network | You own capacity; needs upstream scrubbing |
| Ops burden during launch | Low — vendor updates managed rules | High — you are on call for rule behavior |
| Cost at launch scale | Entry plans are affordable at launch traffic (pending verification) | Software free; infrastructure and engineering time real |
| Best fit | Most teams launching a public API | Data-residency constraints or latency-critical stacks |
Step-by-step: launch-day WAF setup
- Point your API hostnames at the WAF (DNS proxy or reverse-proxy integration) and verify TLS and certificate handling end to end.
- Enable the managed ruleset in detection/log-only mode; confirm requests are being logged with rule match IDs.
- Set initial rate limits from your traffic projections, with a 2–3x safety margin above projected peak.
- Replay a small set of real client calls (your own SDK, curl, a mobile client) through the WAF and verify responses are unchanged.
- Review 24 hours of logs: classify every block as attack, bot, or false positive; fix the false positives.
- Switch the ruleset to blocking mode once the false-positive rate is acceptable (sub-1% is a reasonable target; pending verification).
- Set up alerting on 403/406/429 spikes, blocked-request volume, and direct-to-origin traffic attempts.
- Publish a client-facing error format for blocked requests so your API consumers can debug cleanly.
- Schedule a full bypass re-test within the first month, since attackers will try encoded payloads early.
Common launch mistakes and how to avoid them
- Protecting only the website: attackers probe the API directly — cover every public hostname.
- Launching in blocking mode with default rules: you will block your own clients and not know why; start monitored.
- Leaking the origin IP: via DNS history, error pages, or third-party integrations; hide and restrict it.
- Rate limiting by IP only: mobile carriers and shared NAT will break your own users; combine key-based limits.
- No alerting: a WAF that blocks silently during your launch week hides the attack from you.
- Forgetting error-page hygiene: verbose WAF error pages leak stack details and framework versions.
Advanced tips for the weeks after launch
- Add schema validation or request-shape checks for your main endpoints — cheap, effective attack reduction.
- Introduce bot management once scraping or credential stuffing becomes visible in the logs.
- Build an encoded-payload regression corpus from the bypass techniques you expect (see WAFNinja's 10-technique list) and run it in CI.
- Review rate limits monthly against real traffic percentiles; tighten as you learn.
- Consider per-endpoint rules: auth and payment endpoints get stricter rules than public read endpoints.
- Document your WAF config as code so it is reviewable and reproducible.
Related concepts explained briefly
- L7 DDoS: floods of application-layer requests that exhaust CPU, database connections, or TLS handshakes — a network firewall at Layers 3 and 4 cannot stop them, so the WAF plus edge absorption is the defense.
- OWASP CRS: an open ruleset of attack signatures and anomaly scoring; the common baseline for "OWASP rules on."
- Rate limiting: capping request frequency per key or IP; your first defense against abuse and credential stuffing.
- Bot management: distinguishing automated from human traffic by fingerprinting and behavior — a later-stage add-on.
- Fail-open: letting traffic pass when the WAF itself fails, trading brief exposure for availability.
FAQ
Do we need a WAF on day one, or can we add it later?
Add it on day one, at least in monitored mode. The first week of a public API is the highest-signal attack period, and retrofitting a WAF later means you lose that visibility and teach attackers a stable target first.
Should the WAF rules be in blocking mode at launch?
Start in monitored mode for 24–72 hours, review false positives, then switch to blocking. Launching straight into blocking with default rules is the most common self-inflicted outage.
What if we use an API gateway — is a WAF still needed?
Gateways handle routing, auth, and quotas; they are not full application-layer inspection engines. Run both: gateway for API policy, WAF for attack payload inspection and DDoS defense.
How much does day-one WAF protection cost?
Cloud-managed entry plans are usually affordable at launch traffic, and self-hosted software is free — but the real cost is engineering time. See the companion article on WAF budgets for a full breakdown (pricing figures pending verification).
Sources and verification
Verified facts: DDoS attacks have evolved to the Layer 7 application layer; network firewalls make decisions at OSI Layers 3 and 4; web traffic uses port 80 (HTTP); SSH uses port 22; WAFNinja's guide lists 10 WAF bypass techniques still relevant in 2026 — all from WAFNinja published guides (wafninja.com), verified 2026-08-04. Rate-limit figures, log retention recommendations, and cost figures are marked pending verification and should be tuned to your traffic and compliance requirements.