Rack middleware to remove "HTTP_X_FORWARDED_FOR" in the Rack environment and replace "REMOTE_ADDR" with the value of the original client address.
IPv4 localhost addresses (127.0.0.0/8)
IPv6 localhost address (::1/128)
local LAN addresses described in RFC 1918
new (app, trusted = [:RFC_1918, :LOCALHOST, :LOCALHOST6]) source
In your Rack config.ru:
use UnXF
If you do not want to trust any hosts other than "0.6.6.6", you may only specify one host to trust:
use UnXF, "0.6.6.6"
If you want to trust "0.6.6.6" in addition to the default set of hosts:
use UnXF, [ :RFC_1918, :LOCALHOST, "0.6.6.6" ]
on_broken_addr (env, xff_str) source
Our default action on a broken address is to just fall back to calling the app without modifying the env
on_untrusted_addr (env, xff_str) source
Our default action on an untrusted address is to just fall back to calling the app without modifying the env
unxf! (env) source
returns nil
on success and a Rack response triplet on failure This allows existing applications to use UnXF
without putting it into the middleware stack (to avoid increasing stack depth and GC time)
mail archives: http://bogomips.org/unxf-public/ nntp://news.public-inbox.org/inbox.comp.lang.ruby.unxf public: unxf-public@bogomips.org source code: git clone http://bogomips.org/unxf.git git clone git://bogomips.org/unxf.git