masaori335 opened a new pull request, #14045:
URL: https://github.com/apache/trafficserver/pull/14045

   # Motivation
   
   This is a follow-up to #12761, which made the core use the PROXY protocol 
source as the client IP on a port with
   `pp-clnt` (`%<chi>`, ACLs, header_rewrite). Cripts' 
`Client::Connection::IP()` still read the TCP peer, so behind a
   PROXY protocol load balancer a cript checked and geolocated the load 
balancer instead of the client.
   
   # Approach
   
   `Client::Connection::IP()` asks `TSHttpTxnClientAddrGet()`, as 
header_rewrite does, so it follows the core.
   `Server::Connection::IP()` and `Socket()` are unchanged; `Socket()` still 
returns the TCP peer.
   
   `TSHttpTxnClientAddrGet()` can return no address, so an `IP` with no address 
now converts to an empty endpoint, and a
   GEO lookup on it answers `(unknown)`.
   
   # Compatibility
   
   - **Without `pp-clnt` (the default): no change.** `IP()` returns the TCP 
peer as before, even if a PROXY header arrives.
   - With `pp-clnt`: `IP()` returns the PROXY protocol source, the same client 
as `%<chi>`.
   
   # Testing
   
   `cripts_client_ip` urtest runs two sessions, with and without a PROXY 
header, on a `pp` port without and with
   `pp-clnt`. It checks that `IP()` matches `%<chi>` in each case. The variant 
without `pp-clnt` covers the unchanged
   default; the `pp-clnt` variant fails without this change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to