Real IP Plugin

Description

The realip plugin reads an IP address from a specified data source such as HTTP header field, and makes it available for ATS and its plugins as the verified client address.

To use the verified client IP address for ACL, proxy.config.acl.subjects needs to be set to PLUGIN. Similary, if you want to use the IP address on header_rewrite plugin, its INBOUND_IP_SOURCE needs to be set to PLUGIN.

Configuration

To enable the realip plugin, insert the following line in plugin.config:

realip.so <config.yaml>

The plugin supports 2 modes:

simple

The plugin reads an IP address from a specified HTTP header field. These settings below are available for this mode:

Setting name

Description

header

HTTP field name that has an IP address. The field value must be a valid IP address. You cannot use this mode for Forwarded header field () because its field value is structured.

trustedAddress

A list of trusted IP addresss, and/or IP address ranges. The IP address in the specified header field will not be used if the sender’s address is not trusted.

proxyProtocol

The plugins reads an IP address from PROXY protocol header field. Although there is no plugin settings for this mode, server_ports and proxy_protocol_allowlist on records.yaml need to be configured to accept PROXY protocol.

Example Configuration

Use Client-IP header, if the header is sent from 192.168.0.0/24 or 127.0.0.1.

simple:
  header: "Client-IP"
  trustedAddress:
    - "192.168.0.0/24"
    - "127.0.0.1"

Use PROXY protocol header.

proxyProtocol: