Rails - 机架攻击 gem 使用 AWS elastic beantalk 节流
Rails - Rack Attack gem throttle with AWS elastic beanstalk
我已尝试设置 Rack Attack gem 以进行节流。但是,我使用 aws elastic beanstalk,我发现由于负载均衡器,用户的 ip 地址对于所有请求都是相同的。有没有办法解决它并获取用户的 ip 或任何其他方式来设置它?
这是我现在用于 Rack Attack gem:
的代码
class Rack::Attack
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
Rack::Attack.throttle('req/ip', :limit => 10, :period => 10.second) do |req|
req.ip
end
end
您正在查找“如何配置代理协议支持”
Proxy Protocol is an Internet protocol used to carry connection information from the source requesting the connection to the destination for which the connection was requested. Elastic Load Balancing uses Proxy Protocol version 1, which uses a human-readable header format.
Configure Proxy Protocol Support for Your Classic Load Balancer
内容
我已尝试设置 Rack Attack gem 以进行节流。但是,我使用 aws elastic beanstalk,我发现由于负载均衡器,用户的 ip 地址对于所有请求都是相同的。有没有办法解决它并获取用户的 ip 或任何其他方式来设置它? 这是我现在用于 Rack Attack gem:
的代码class Rack::Attack
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
Rack::Attack.throttle('req/ip', :limit => 10, :period => 10.second) do |req|
req.ip
end
end
您正在查找“如何配置代理协议支持”
Proxy Protocol is an Internet protocol used to carry connection information from the source requesting the connection to the destination for which the connection was requested. Elastic Load Balancing uses Proxy Protocol version 1, which uses a human-readable header format.
Configure Proxy Protocol Support for Your Classic Load Balancer