vendredi 29 mai 2020

Laravel Dynamic Rate Limiting - Exponential Throttling

I am approaching the laraverl built-in throttling middleware to protect some of my REST APIs from possible scrapers or other not authorized operations. I have obviously implemented other methods apart from throttling to prevent that, but I think this piece is essential to make the system more safe overall.

I have generally understood how the throttle system works and I could implement it easly. My question is: is it possible to make the throttle exponential?

Let me explain better:

  • A user is initally blocked for 1 minute
  • If The user reaches the limit again in the 1 minute after, he is then blocked for 2 minutes
  • If all this happens again, the user is blocked for 4 minutes
  • If the user behave well in the next 4 minutes, the block gets reduced to 2 and so on

If you think my implementation is wrong and it could be done better in another way, I am happy to hear that. Otherwise the question is how to implement this on Laravel.

Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire