kickstarter/rack-attack — pull request #40 by rauchy (2014-01-14 12:29:44+00:00)
Title: Support different throttle responders

First of all, I just want to clarify that this is *not* the final way I want to submit this pull-request.

I'm using Rack::Attack's throttles in one of the apps I'm working on and I found the "retry later" response to be a bit harsh, especially when blocking IP addresses that have lots of users using them simultaneously (think NATs). So what I was hoping to do is to allow other forms of throttle responses - "retry later" being one, the other would be to add Recaptcha tags to forms. Perhaps some other responders will be developed in the future.

I *don't* think this needs to be part of Rack::Attack because it kinda forces a dependency with recaptcha, so my goal is to create a rack-attack-recaptcha gem, that will replace the responder with a recaptcha responder and provide the different Rails helpers.

In order to achieve that, I first need to introduce the concept of "Responders" to Rack::Attack so that rack-attack-recaptcha (and maybe other gems in the future) could configure the responder. I am sending this pull request which includes the recatpcha-specific bits, so you can have an overview of the entire solution (which works in our app).

If you feel comfrotable with this approach, I will update the pull-request to include only the Rack::Attack-specific bits (with some modifications for configuration) and continue to release rack-attack-recaptcha.