Skip to content

Commit

Permalink
Merge pull request #4363 from sul-dlss/suppress-notices
Browse files Browse the repository at this point in the history
Don't send throttling notices for known-abusive IPs.
  • Loading branch information
jcoyne authored Aug 7, 2024
2 parents bae6432 + 71ade8e commit 4c6527e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
match_data = request.env['rack.attack.match_data']
now = match_data[:epoch_time]

if Settings.SEND_THROTTLE_NOTIFICATIONS_TO_HONEYBADGER && (((match_data[:limit] - match_data[:count]) < 5) || (match_data[:count] % 10).zero?)
if Settings.SEND_THROTTLE_NOTIFICATIONS_TO_HONEYBADGER &&
(((match_data[:limit] - match_data[:count]) < 5) || (match_data[:count] % 10).zero?) &&
!request.remote_ip&.start_with?(/15\d\./) # ignore abuse from hwclouds (among others)
Honeybadger.notify("Throttling request", context: { ip: request.ip, path: request.path }.merge(match_data))
end

Expand Down

0 comments on commit 4c6527e

Please sign in to comment.