Solution skill
Workflow: protecting a public API on Cloudflare
Complete solution
Guide Workflow: protecting a public API on Cloudflare: Deploy in Log mode, pick thresholds from the request-rate analysis, then enforce. # Workflow: API protection ## 1. Use this when you hit exactly this in Workflow. Not for different errors or different tools.
TL;DR: Deploy in Log mode, pick thresholds from the request-rate analysis, then enforce. # Workflow: API protection ## 1. Key-based rate limiting Count by API key (or JA3 fingerprint), not just IP: NAT and mobile carriers put many users behind one IP.
Fix
Deploy in Log mode, pick thresholds from the request-rate analysis, then enforce. Expected: this specific failure stops.
Details
Workflow: API protection ## 1. Key-based rate limiting Count by API key (or JA3 fingerprint), not just IP: NAT and mobile carriers put many users behind one IP. Count failures for auth endpoints. ## 2. Skip rules for your own monitoring and partner integrations go first. ## 3. Cache rules: never cache authenticated responses The dangerous misconfiguration: a Cache Rule caching /api/* that serves one user's data to everyone. Cache only unauthenticated, public endpoints, and key the cache to exclude Authorization headers. When in doubt, DYNAMIC (do not cache) for anything behind auth. ## 4. Origin protection The API origin should only accept traffic from Cloudflare IPs (allowlist) so attackers cannot bypass the WAF by hitting the origin directly. Authenticated origin pulls (TLS client certs) make this airtight. ## 5. Observability Tail the Worker (if the API runs on Workers) or watch origin logs with the real client IP restored via CF-Connecting-IP . Alert on 429 spikes (rate limit too tight) and 403 spikes (WAF false positives). ## Checklist - Rate limit by key, WAF for patterns, cache never for authed responses. - Origin locked to Cloudflare IPs. - 429/403 spikes are the tuning signals.
When to use
You hit exactly this: Workflow: protecting a public API on Cloudflare in Workflow.
When not to use
A different error, or the same symptom in a different tool. This page only covers the failure above.
Compatibility
Workflow.
Edge cases
- WAF custom rules for abuse Block known-bad patterns (credential stuffing paths, scanner user agents) with narrow rules.
Evidence
Composite workflow grounded in verified docs: rate limiting characteristics and Log-first deployment, WAF custom rule ordering with Skip, Cache Rules, proxied source-IP restoration. Refs: https://developers.cloudflare.com/waf/rate-limiting-rules/create-zone-dashboard/ , https://developers.cloudflare.com/waf/custom-rules/ , https://developers.cloudflare.com/cache/how-to/cache-rules/
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_6emweTAWKnul7SxmUIeLxQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workflow: protecting a public API on Cloudflare <span>— Vectle</span></a>