diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2013-09-27 00:40:55 +0400 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2013-09-30 13:10:46 +0400 |
commit | 055b60d4200aeee0eeab762f162c05305e58c41d (patch) | |
tree | 46efa952dcd01e92fa6217bed2b0f990261253f9 /config/initializers/rack_attack.rb.example | |
parent | c562d290eaab16f8e72e7e3e9ff188e172372226 (diff) |
Add documentation to help section, rack_attack as example
Diffstat (limited to 'config/initializers/rack_attack.rb.example')
-rw-r--r-- | config/initializers/rack_attack.rb.example | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config/initializers/rack_attack.rb.example b/config/initializers/rack_attack.rb.example new file mode 100644 index 00000000000..76fa7ad282e --- /dev/null +++ b/config/initializers/rack_attack.rb.example @@ -0,0 +1,16 @@ +# To enable rack-attack for your GitLab instance do the following: +# 1. In config/application.rb find and uncomment the following line: +# config.middleware.use Rack::Attack +# 2. Rename this file to rack_attack.rb +# 3. Review the paths_to_be_protected and add any other path you need protecting +# 4. Restart GitLab instance +# + +paths_to_be_protected = [ + "#{Rails.application.config.relative_url_root}/users/password", + "#{Rails.application.config.relative_url_root}/users/sign_in", + "#{Rails.application.config.relative_url_root}/users" +] +Rack::Attack.throttle('protected paths', limit: 6, period: 60.seconds) do |req| + req.ip if paths_to_be_protected.include?(req.path) && req.post? +end |