The SaaS Founder's Guide to DDoS Protection Without Enterprise Budget
Key Facts
Direct answer: The direct answer is that DDoS protection for a small SaaS has three layers: Cloudflare (free, edge filtering), rate limiting (free, origin filtering), and health checks (free, automatic recovery). Together, these three layers block most DDoS attacks before they reach your app.
Layer 1: Cloudflare (Free, Edge Filtering): Cloudflare is a CDN and security service that sits in front of your SaaS.
Layer 2: Rate Limiting (Free, Origin Filtering): Rate limiting at the origin (your app) handles attacks that slip through Cloudflare.
Layer 3: Health Checks and Auto-Restart (Free, Automatic Recovery): If a DDoS attack slips through Cloudflare and rate limiting and overwhelms your app, the health check detects the failure and the platform restarts the container automatically.
What to Do During a DDoS Attack: If your SaaS is under a DDoS attack.
A DDoS (Distributed Denial of Service) attack sends thousands of requests per second to your SaaS, overwhelming your server and causing an outage. DDoS attacks are not just for big companies — small SaaS are targeted too, often by competitors, disgruntled users, or random attackers. The good news is that basic DDoS protection is free and takes 30 minutes to set up. This article is the founder's guide to DDoS protection without an enterprise budget.
The direct answer is that DDoS protection for a small SaaS has three layers: Cloudflare (free, edge filtering), rate limiting (free, origin filtering), and health checks (free, automatic recovery). Together, these three layers block most DDoS attacks before they reach your app. For more on DDoS protection, see our article on how we handle DDoS protection.
Layer 1: Cloudflare (Free, Edge Filtering)
Cloudflare is a CDN and security service that sits in front of your SaaS. It filters traffic at the edge (before it reaches your server), blocking obvious DDoS attacks automatically. Cloudflare's free tier includes:
- DDoS protection. Cloudflare automatically detects and blocks common DDoS attacks (SYN floods, UDP floods, HTTP floods) at the edge.
- Rate limiting. Cloudflare can limit the number of requests per IP at the edge, before they reach your server.
- Bot protection. Cloudflare can challenge or block known bots.
- Web Application Firewall (WAF). Cloudflare's WAF blocks common attacks (SQL injection, XSS).
How to set up Cloudflare (free)
- Create a Cloudflare account (free).
- Add your domain to Cloudflare.
- Update your DNS to point to Cloudflare's nameservers.
- Enable "Proxy" (orange cloud) for your domain.
- Enable "Always Use HTTPS" (redirects HTTP to HTTPS).
- Set the security level to "Medium" (blocks most attacks without false positives).
Deployxa uses Cloudflare in front of all apps automatically, so if you are on Deployxa, you already have Cloudflare DDoS protection. For more, see our article on how we handle DDoS protection.
Layer 2: Rate Limiting (Free, Origin Filtering)
Rate limiting at the origin (your app) handles attacks that slip through Cloudflare. The key endpoints to rate limit:
- Login. 5 attempts per minute per IP (prevents brute-force).
- API. 100 requests per minute per user (prevents scraping and resource exhaustion).
- Signup. 5 signups per hour per IP (prevents mass account creation).
For more on rate limiting, see our article on the SaaS founder's guide to API rate limiting.
Layer 3: Health Checks and Auto-Restart (Free, Automatic Recovery)
If a DDoS attack slips through Cloudflare and rate limiting and overwhelms your app, the health check detects the failure and the platform restarts the container automatically:
- Health check. The /health endpoint returns non-200 when the app is overwhelmed, which signals the platform to restart the container.
- Auto-restart. The platform restarts the container, which clears the memory and kills any runaway processes.
- Auto-scaling. If the container is consistently overwhelmed, the platform can scale to multiple containers (to distribute the load).
For more on health checks, see our article on the health check system.
What to Do During a DDoS Attack
If your SaaS is under a DDoS attack:
- Check the status page. Is the app actually down, or is it just slow? If it is slow but responding, Cloudflare is handling the attack.
- Enable Cloudflare "Under Attack" mode. This shows a JavaScript challenge to every visitor, which blocks most DDoS bots (they cannot execute JavaScript). This adds a 5-second delay for legitimate users but keeps the app online.
- Add rate limiting rules. If the attack targets a specific endpoint (e.g., the login endpoint), add a stricter rate limit for that endpoint.
- Scale up. If the app is overwhelmed, scale to more containers (to distribute the load).
- Communicate with customers. Post an incident on your status page: "We are experiencing a DDoS attack. Some users may experience slow responses. We are mitigating the attack and will provide an update within 15 minutes."
For more on incident communication, see our article on the SaaS founder's guide to status pages and customer communication.
Common Pitfalls and Troubleshooting
The first pitfall is not using Cloudflare. Without Cloudflare, all traffic goes directly to your server, which is easily overwhelmed. The fix is to set up Cloudflare (free).
The second pitfall is not rate limiting. Without rate limiting, an attacker can send thousands of requests per second, even through Cloudflare. The fix is to rate limit key endpoints.
The third pitfall is not having a health check. Without a health check, the platform cannot detect when the app is overwhelmed, which means it does not restart the container. The fix is to implement a /health endpoint.
The fourth pitfall is panicking during an attack. DDoS attacks are stressful, but panic leads to bad decisions (e.g., shutting down the server, which makes the outage worse). The fix is to have a DDoS response plan (the steps above) and to execute it calmly.
The fifth pitfall is not testing the DDoS protection. If you do not test it, you do not know if it works. The fix is to use a load testing tool (e.g., k6, Artillery) to simulate a traffic spike and verify Cloudflare and rate limiting handle it.
Conclusion: Free Protection Is Better Than No Protection
DDoS protection is not just for enterprise companies. With Cloudflare (free), rate limiting (free), and health checks (free), you can protect your SaaS from most DDoS attacks without spending a dollar. The key is to set up the three layers before you need them, so when an attack comes, you are prepared.
Ready to protect your SaaS? Set up Cloudflare, add rate limiting, and implement a health check. For more, see how we handle DDoS protection and the practical security checklist for early-stage SaaS. Explore our free developer tools to speed up your workflow.