github.com/nginxinc/kubernetes-ingress@v1.12.5/examples/proxy-protocol/README.md (about)

     1  # PROXY Protocol
     2  
     3  Proxies and load balancers, such as HAProxy or ELB, can pass the client's information (the IP address and the port) to the next proxy or load balancer via the PROXY Protocol. To enable NGINX Ingress controller to receive that information, use the `proxy-protocol` ConfigMaps configuration key as well as the `real-ip-header` and the `set-real-ip-from` keys. Once you enable the PROXY Protocol, it is enabled for every Ingress resource.
     4  
     5  ## Syntax
     6  
     7  The `proxy-protocol` key syntax is as follows:
     8  ```
     9  proxy-protocol: "True | False"
    10  ```
    11  
    12  Additionally, you must configure the following keys:
    13  * **real-ip-header**: Set its value to `proxy_protocol`.
    14  * **set-real-ip-from**: Set its value to the IP address or the subnet of the proxy or the load balancer. See https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
    15  
    16  ## Example
    17  
    18  In the example below we configure the PROXY Protocol via a ConfigMaps resource. The IP address of the proxy which is in front of the Ingress controller is `192.168.192.168`.
    19  
    20  ```yaml
    21  kind: ConfigMap
    22  apiVersion: v1
    23  metadata:
    24    name: nginx-config
    25  data:
    26    proxy-protocol: "True"
    27    real-ip-header: "proxy_protocol"
    28    set-real-ip-from: "192.168.192.168"
    29  ```
    30  After we create the ConfigMaps resource, in the NGINX configuration the client's IP address is available via the `$remote_addr` variable. By default, NGINX Ingress controller logs the value of this variable and also passes the value to the backend service in the `X-Real-IP` header.