Rate limiting via Nginx
I needed to integrate rate limiting into a relatively small service that complements a monolith I was working on. My initial thought was to apply it at the application layer, as it seemed to be the simplest route. Plus, I didn’t want to muck around with load balancer configurations, and there’s no shortage of libraries that allow me to do this quickly in the app. However, this turned out to be a bad idea. In the event of a DDoS or thundering herd incident, even if the app rejects the influx of inbound requests, the app server workers still have to do a minimal amount of work. ...