【发布时间】:2015-08-25 03:34:04
【问题描述】:
我正在创建一个应用程序,其中前端是 Haproxy 和 nginx。 如果使用 HAproxy 在匿名代理后面导航,您知道获取客户端 IP 地址的方法吗?
我对 haproxy 的实际配置使用“选项 forwardfor”,但我在 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
谢谢
【问题讨论】:
-
不清楚你想要什么。匿名代理不会公开他们的客户地址。这是他们的目的。
标签: nginx proxy haproxy anonymous