Rancher入门到精通2.0- nginx-ingress客户端 真实ip获取配置

负载地址

负载需要配合修改

配置后获取真实ip地址

nginx-ingress配置

Rancher入门到精通2.0- nginx-ingress客户端 真实ip获取配置_第1张图片

apiVersion: v1
data:
  compute-full-forwarded-for: "true"
  forwarded-for-header: X-Forwarded-For
  use-forwarded-headers: "true"
kind: ConfigMap

nginx配置location添加

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $http_x_forwarded_for;

 

nginx 日志配置

log_format  main  '$remote_addr - $remote_user [$time_l

你可能感兴趣的:(Rancher入门到精通)