简体   繁体   中英

haproxy + nginx get client ip behind anonymous proxy

I'm creating an application, where frontend is Haproxy and nginx. Do you know a way to get client IP address if navigates behind anonymous proxy with HAproxy ?

My actual configuration for haproxy use "option forwardfor", but I get anonymous proxy IP instead real client IP in nginx logs (using $http_x_forwarded_for var)

frontend general_frontend
  bind 111.111.111.111:80
  default_backend nginx_farm_backend
backend nginx_farm_backend
  balance roundrobin
  option  abortonclose
  option  forwardfor

  http-check disable-on-404
  http-check expect string nginx
  option httpchk GET /index.html HTTP/1.0

  # - Nodes
  server  nginx-server-1 222.222.222.222:8080 check on-error mark-down observe layer7 error-limit 1
  server  nginx-server-1 333.333.333.333:8080 check on-error mark-down observe layer7 error-limit 1

Thank you

您是否将$ remote_addr var用于nginx日志格式?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM