How to avoid flooding ajax request in django

In django, I created a simple ajax handler that will check the POST request and successfully write to the database, which will later be available for public inspection. Anonymous is allowed in this case.

It seems that StackOverFlow will accept questions sent by the logged in and non-logged in user, we would have had similar approval.

How do I handle scripts / robots that constantly submit ajax requests to my URL for spam / DOS purposes?

+3
source share
1 answer

There are several ways to do this. If you do not want to do this through the lower level (server, load balancer), 0 may be a good choice.

It can throttle anonymous cookie requests / IP addresses. Just call the view through the handler, apply the appropriate decorator, and you should be set up.

+1
source

Source: https://habr.com/ru/post/1751317/


All Articles