Skip to content

Commit

Permalink
Merge pull request #1423 from rubymonsters/1421-throttle-OAI-bot
Browse files Browse the repository at this point in the history
Try to throttle OAI Searchbot more than others
  • Loading branch information
zaziemo authored Nov 4, 2024
2 parents f882038 + 98ca9c2 commit bf4d786
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class Rack::Attack
# Throttle all requests by IP (60rpm)
#
# Key: "rack::attack:#{Time.now.to_i/:period}:req/ip:#{req.ip}"
throttle('req/user_agent', limit: 10, period: 5.minutes) do |req|
req.user_agent == 'OAI-SearchBot'
end

throttle('req/ip', limit: 100, period: 5.minutes) do |req|
req.ip
end
Expand Down

0 comments on commit bf4d786

Please sign in to comment.