class
Amber::Pipe::ClientIp
- Amber::Pipe::ClientIp
- Amber::Pipe::Base
- Reference
- Object
Overview
Saves the real client IP address to context.client_ip.
By default it uses HTTP::Request#client_ip: the peer's own address
for an untrusted peer, and for a trusted proxy (server.trusted_proxies)
the nearest untrusted hop in the header family the proxy writes
(X-Forwarded-For, or Forwarded: for=), read from the right. See
Amber::Router::ClientAddress.
Given header names, it reads the first of those headers that is present instead, with the same rule: the header is believed only from a trusted proxy, and walked from the right. Name a header only when the trusted proxy sets it on every request and so overwrites any value a client sent; a proxy passes other headers through unchanged, and the client would choose its own address.
Defined in:
amber/pipes/client_ip.crConstructors
Instance Method Summary
-
#call(context : HTTP::Server::Context)
Execution of this handler.
Instance methods inherited from class Amber::Pipe::Base
call(context : HTTP::Server::Context)
call
Constructor Detail
Instance Method Detail
Execution of this handler.