mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Merge pull request #23 from zmillman/master
Explain why README examples use 503 to distract attackers
This commit is contained in:
commit
8ece6925aa
1 changed files with 4 additions and 0 deletions
|
|
@ -165,6 +165,8 @@ Customize the response of blacklisted and throttled requests using an object tha
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Rack::Attack.blacklisted_response = lambda do |env|
|
Rack::Attack.blacklisted_response = lambda do |env|
|
||||||
|
# Using 503 because it may make attacker think that they have successfully
|
||||||
|
# DOSed the site. Rack::Attack returns 401 for blacklists by default
|
||||||
[ 503, {}, ['Blocked']]
|
[ 503, {}, ['Blocked']]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -176,6 +178,8 @@ Customize the response of blacklisted and throttled requests using an object tha
|
||||||
env['rack.attack.match_data']
|
env['rack.attack.match_data']
|
||||||
].inspect
|
].inspect
|
||||||
|
|
||||||
|
# Using 503 because it may make attacker think that they have successfully
|
||||||
|
# DOSed the site. Rack::Attack returns 429 for throttling by default
|
||||||
[ 503, {}, [body]]
|
[ 503, {}, [body]]
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue