File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed
Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ gem "pagy"
1919gem "pg" , "~> 1.6"
2020gem "propshaft"
2121gem "puma" , ">= 5.0"
22+ gem "rack-attack"
2223gem "rails" , "~> 8.0.1"
2324gem "requestjs-rails"
2425gem "scout_apm"
Original file line number Diff line number Diff line change 386386 raabro (1.4.0 )
387387 racc (1.8.1 )
388388 rack (3.2.0 )
389+ rack-attack (6.7.0 )
390+ rack (>= 1.0 , < 4 )
389391 rack-mini-profiler (4.0.1 )
390392 rack (>= 1.2.0 )
391393 rack-session (2.1.1 )
@@ -616,6 +618,7 @@ DEPENDENCIES
616618 pg (~> 1.6 )
617619 propshaft
618620 puma (>= 5.0 )
621+ rack-attack
619622 rack-mini-profiler
620623 rails (~> 8.0.1 )
621624 rails-controller-testing
Original file line number Diff line number Diff line change 1+ class Rack ::Attack
2+ Rack ::Attack . enabled = Rails . env . production?
3+
4+ Rack ::Attack . throttle ( "requests by ip" , limit : 5 , period : 2 ) do |request |
5+ request . ip
6+ end
7+
8+ Rack ::Attack . blocklist ( "php-bots" ) do |req |
9+ req . ip if /\S +\. php/ . match? ( req . path )
10+ end
11+ end
You can’t perform that action at this time.
0 commit comments