My fail2ban Banned Cloudflare and Took My Own Site Down
On 3 November, at 10:02 UTC, most of my website started returning 500 errors. Service pages, project pages, blog posts: anything that needed data from my API was broken. The API itself was fine. Its process was running and its health check passed.
Thirteen minutes later it was fixed, and the culprit turned out to be my own security setup, triggered by my own SEO crawler. This is what happened, how I reproduced it, and the second problem I found while reproducing it, which was still live on my server after the fix.
The setup
My site is a Next.js frontend and a NestJS API on one Linux server, with Cloudflare in front of both. The API is protected the usual way:
- nginx limit_req: 20 requests per second per client, with a burst of 60. Anything beyond that gets a 429.
- A fail2ban jail on nginx's error log: if a...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE