Ā© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•3y ago•
14 replies
AlphaCentauri

Protecting API endpoints from DDoS Attacks

Hey šŸ‘‹

I have a basic(ish) Express API with a handful of GET endpoints, but because it’s an API that supports non-human interaction, traditional DDoS protection such as a managed challenge wouldn’t work in protecting malicious actors from DDoS’ing my server, and if anything I need to reduce false positives by allowing almost all traffic to hit my origin.

I’ve thought about using Workers and KV to sync my user’s API keys and validate them at Cloudflare before hitting my origin, but whilst this would keep my origin online during a DDoS, it would result in me potentially being charged into bankruptcy if I get hit with a major attack (such as billions of requests)

I’ve thought about doing something like implementing a WAF rule to block all requests where the Authorization header doesn’t include a prefix in all the API keys I issue to users, but this is of course super easy to bypass if someone figures it out.

I’ve thought about syncing every API key to WAF as a whitelist and block everything else, but this wouldn’t scale well as the expression for a rule can only be 4096 characters long.

If someone knows a way that I could effectively protect my API, that would be much appreciated šŸ™

I’m on the Pro plan btw.
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

DDOS Attacks
Cloudflare DevelopersCDCloudflare Developers / general-help
12mo ago
DDoS Attacks Leaking
Cloudflare DevelopersCDCloudflare Developers / general-help
13mo ago
Help with DDoS attacks
Cloudflare DevelopersCDCloudflare Developers / general-help
11mo ago
DDOs Attacks on CF Pages
Cloudflare DevelopersCDCloudflare Developers / general-help
3y ago