X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/b49e209b3e957e9c02139c06f0dfecac05415119..4540ea2e1dd03ebb2487bacfa9888d0e1ccb9c23:/cookbooks/tile/templates/default/tile-ratelimit.erb diff --git a/cookbooks/tile/templates/default/tile-ratelimit.erb b/cookbooks/tile/templates/default/tile-ratelimit.erb index f0483b4d7..63e7711b3 100755 --- a/cookbooks/tile/templates/default/tile-ratelimit.erb +++ b/cookbooks/tile/templates/default/tile-ratelimit.erb @@ -50,6 +50,7 @@ File::Tail::Logfile.tail("/var/log/apache2/access.log") do |line| hash = parser.parse!(line) address = hash["%a"] + request = hash["%r"] next if address == "127.0.0.1" || address == "::1" @@ -61,7 +62,11 @@ File::Tail::Logfile.tail("/var/log/apache2/access.log") do |line| decay_count(client, time) - client[:request_count] = client[:request_count] + 1 + if request =~ %r{^(GET|POST) /cgi-bin/export.*} + client[:request_count] = client[:request_count] + 150 + else + client[:request_count] = client[:request_count] + 1 + end if client[:request_count] > BLOCK_AT && !client.has_key?(:blocked_at) puts "Blocked #{address}"