Ingress-nginx: get the real ip error

Created on 27 May 2019  路  1Comment  路  Source: kubernetes/ingress-nginx

NGINX Ingress controller version:
0.24.1

Kubernetes version (use kubectl version):
1.11.1

What happened:

the configration  $the_real_ip in ingress nginx controller 0.15.0 is 

        map $http_x_forwarded_for $the_real_ip {
                default          $remote_addr;
        }
the configration  $the_real_ip in ingress nginx controller 0.24.1 is 

       map '' $the_real_ip {
                default          $remote_addr;
        }

in version 0.24.1 my php in pod can not get user real ip
my structure lvs+nginx+ingress nginx +nginx +php

What you expected to happen:
in php x_forward should hava 3 ips

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know:

Most helpful comment

i have got a way to fix my probelem
add the fllow configrations to configmap nginx-configuration

compute-full-forwarded-for: 'true'
use-forwarded-headers: 'true'

kind: ConfigMap
apiVersion: v1
metadata:
  name: nginx-configuration
  namespace: ingress-nginx
  labels:
    app: ingress-nginx
data:
  compute-full-forwarded-for: 'true'
  use-forwarded-headers: 'true'

reference
rootfs/etc/nginx/template/nginx.tmpl

>All comments

i have got a way to fix my probelem
add the fllow configrations to configmap nginx-configuration

compute-full-forwarded-for: 'true'
use-forwarded-headers: 'true'

kind: ConfigMap
apiVersion: v1
metadata:
  name: nginx-configuration
  namespace: ingress-nginx
  labels:
    app: ingress-nginx
data:
  compute-full-forwarded-for: 'true'
  use-forwarded-headers: 'true'

reference
rootfs/etc/nginx/template/nginx.tmpl

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oilbeater picture oilbeater  路  3Comments

boazj picture boazj  路  3Comments

lachlancooper picture lachlancooper  路  3Comments

natemurthy picture natemurthy  路  3Comments

bashofmann picture bashofmann  路  3Comments