Commit a1b2bbee

mo khan <mo@mokhan.ca>
2014-09-11 02:36:15
whitelist localhost.
1 parent 0aa335b
Changed files (1)
config
initializers
config/initializers/rack_attack.rb
@@ -1,3 +1,10 @@
+# Always allow requests from localhost
+# (blacklist & throttles are skipped)
+Rack::Attack.whitelist('allow from localhost') do |request|
+  # Requests are allowed if the return value is truthy
+  '127.0.0.1' == request.ip
+end
+
 # Throttle requests to 5 requests per second per ip
 Rack::Attack.throttle('req/ip', :limit => 5, :period => 1.second) do |request|
   # If the return value is truthy, the cache key for the return value