haproxy + nginx在匿名代理后面获取客户端IP

时间:2015-08-24 17:13:14

标签: nginx proxy haproxy anonymous

我正在创建一个应用程序,前端是Haproxy和nginx。 如果使用HAproxy在匿名代理后面导航,您知道获取客户端IP地址的方法吗?

我使用haproxy的实际配置"选项转发",但我在nginx日志中使用匿名代理IP而不是真实客户端IP(使用$ 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

谢谢

0 个答案:

没有答案