class Alfodr::Pipe::ClientIp

Overview

Handler to determine real client IP address when Alfodr 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.

Defined in:

alfodr/pipes/client_ip.cr

Constructors

Instance Method Summary

Instance methods inherited from class Alfodr::Pipe::Base

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

Constructor Detail

def self.new(header : String = "X-Forwarded-For") #

[View source]
def self.new(headers : Array(String)) #

[View source]

Instance Method Detail

def call(context : HTTP::Server::Context) #
Description copied from class Alfodr::Pipe::Base

Execution of this handler.


[View source]