req.ips

If “trust proxy” is enabled, this variable contains the IP addresses in this request’s “X-Forwarded-For” header as an array of the IP address strings. Otherwise an empty array is returned.

Usage

  1. req.ips;

Example

If a request contains a header: “X-Forwarded-For: client, proxy1, proxy2”:

  1. req.ips;
  2. // -> ["client", "proxy1", "proxy2"]`
  3. // ("proxy2" is the furthest "down-stream" IP address)