Skip to content

Commit

Permalink
Fix: Slow response times
Browse files Browse the repository at this point in the history
Because:
- Investigating in NewRelic, Rack attack is adding significant time to requests.

This commit:
- Disables throttling with RackAttack, we have this covered with Cloudflare
  • Loading branch information
KevinMulhern committed Nov 30, 2024
1 parent bcabc75 commit 206c111
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Rack::Attack
Rack::Attack.enabled = ENV['ENABLE_RACK_ATTACK'] || Rails.env.production?

Rack::Attack.cache.store = Redis.new(url: ENV['REDIS_FOR_RACK_ATTACK_URL']) if ENV['REDIS_FOR_RACK_ATTACK_URL']
# Rack::Attack.cache.store = Redis.new(url: ENV['REDIS_FOR_RACK_ATTACK_URL']) if ENV['REDIS_FOR_RACK_ATTACK_URL']

### Throttle Spammy Clients ###

Expand All @@ -16,7 +16,7 @@ class Rack::Attack
# Throttle all requests by IP (60rpm)
#
# Key: "rack::attack:#{Time.now.to_i/:period}:req/ip:#{req.ip}"
throttle('req/ip', limit: 300, period: 5.minutes, &:ip)
# throttle('req/ip', limit: 300, period: 5.minutes, &:ip)

### Prevent Brute-Force Login Attacks ###

Expand Down

0 comments on commit 206c111

Please sign in to comment.