0

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?

  • What did you try? – 030 Jul 10 '15 at 20:19
  • The only thing we've done for this is to specifically deny certain paths using the location directive. For example: location /path/to/asset/unique_id { deny all; return 404; } But this does not scale. – Levi Nunnink Jul 10 '15 at 20:24
  • i would try to combine limit_req and Lua module – Alexey Ten Jul 11 '15 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.