Simplify Rack::Attack (#18403)
This commit is contained in:
parent
560bff9403
commit
05f0e72c24
2 changed files with 3 additions and 6 deletions
|
|
@ -43,11 +43,8 @@ module Rack
|
|||
end
|
||||
|
||||
def self.track_and_return_ip(req)
|
||||
ip_address = if ApplicationConfig["FASTLY_API_KEY"].present?
|
||||
req.env["HTTP_FASTLY_CLIENT_IP"]
|
||||
else
|
||||
req.remote_ip
|
||||
end
|
||||
ip_address = req.env["HTTP_FASTLY_CLIENT_IP"] || req.remote_ip
|
||||
|
||||
return if ip_address.blank?
|
||||
|
||||
Honeycomb.add_field("fastly_client_ip", req.env["HTTP_FASTLY_CLIENT_IP"])
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
require "rails_helper"
|
||||
|
||||
describe Rack, ".attack", type: :request, throttle: true do
|
||||
describe Rack::Attack, type: :request, throttle: true do
|
||||
before do
|
||||
cache_db = ActiveSupport::Cache.lookup_store(:redis_cache_store)
|
||||
allow(Rails).to receive(:cache) { cache_db }
|
||||
Loading…
Add table
Reference in a new issue