Flowdock
method

new

Importance_2
v4.0.2 - Show latest stable - 0 notes - Class: ActionDispatch::RemoteIp
new(app, check_ip_spoofing = true, custom_proxies = nil) public

Create a new RemoteIp middleware instance.

The check_ip_spoofing option is on by default. When on, an exception is raised if it looks like the client is trying to lie about its own IP address. It makes sense to turn off this check on sites aimed at non-IP clients (like WAP devices), or behind proxies that set headers in an incorrect or confusing way (like AWS ELB).

The custom_trusted argument can take a regex, which will be used instead of TRUSTED_PROXIES, or a string, which will be used in addition to TRUSTED_PROXIES. Any proxy setup will put the value you want in the middle (or at the beginning) of the X-Forwarded-For list, with your proxy servers after it. If your proxies aren’t removed, pass them in via the custom_trusted parameter. That way, the middleware will ignore those IP addresses, and return the one that you want.

Show source
Register or log in to add new notes.