Skip to content

Commit

Permalink
Try to throttle OAI Searchbot more than others
Browse files Browse the repository at this point in the history
  • Loading branch information
zaziemo committed Nov 4, 2024
1 parent f882038 commit 98ca9c2
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 98ca9c2

Please sign in to comment.