class

Amber::Pipe::ClientIp

Inherits Amber::Pipe::Base < HTTP::Handler < Reference < Object

Handler to determine real client IP address when Amber is behind trusted reverse proxy or proxies, and save it to context.client_ip.

Reverse proxy should pass client IP in a header such as "X-Forwarded-For". In case of multiple values in a header, the leftmost one is used.

For this functionality to not cause security concerns, all trusted, public-facing reverse proxies should delete the header if request is coming from an untrusted client before appending their own, valid value.

Constructors

new(header : String = "X-Forwarded-For")
Source
new(headers : Array(String))
Source

Instance methods

call(context : HTTP::Server::Context)

Execution of this handler.

Source