We have a service that serves up user-created assets dynamically. So a user can upload a file and share it using a url like
/path/to/asset/unique_id. We currently use the
limit_conn module to protect our system by blocking IP addresses that are flooding us with requests.
But we also want to limit requests based on the request path. So if we get a spike in traffic for
GET /path/to/asset/unique_id, we start limiting requests to that path but the rest of our service continues to serve assets normally.
Right now we're modifying our nginx config to deny requests using the "location" directive once we see a huge spike for a specific path. But we want our service to be proactive and automatically limit requests per path just like how the
limit_conn works for IP addresses.
Does anyone have any idea how to accomplish this? Is it possible?