class Rack::Protection::IPSpoofing
- Prevented attack
-
IP spoofing
- Supported browsers
-
all
- More infos
Detect (some) IP spoofing attacks.
Public Instance Methods
accepts?(env)
click to toggle source
# File lib/rack/protection/ip_spoofing.rb, line 14 def accepts?(env) return true unless env.include? 'HTTP_X_FORWARDED_FOR' ips = env['HTTP_X_FORWARDED_FOR'].split(',').map(&:strip) return false if env.include?('HTTP_CLIENT_IP') && (!ips.include? env['HTTP_CLIENT_IP']) return false if env.include?('HTTP_X_REAL_IP') && (!ips.include? env['HTTP_X_REAL_IP']) true end