Problem: I have a JSON endpoint and like to limit access to it. I.e. to prevent double submits on contact forms or brute force attempts.

One solution that came to my mind was rate-limiting the requests, but I did not find a Craft way to archive this with my controllers.

Another idea was to set the CSRF token to invalid after X requests. Any help would be highly appreciated.

  • Not a real answer, but there's is a guide on how to do it in Yii (which is the framework Craft uses) here that might be helpful: yiiframework.com/doc/guide/2.0/en/rest-rate-limiting
    – Brad Bell
    Jan 24 '20 at 19:20
  • I was aware of the option, since craft has their very own implementation of the user model, i do not see any chance to use the behavior of yii. (please correct me if am wrong)
    – nfo
    Jan 27 '20 at 10:53

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.