我有 HAProxy 服务器的问题。我想在标头中转发客户端 IP。我几乎完成了,但是有一个有趣的案例,我无法弄清楚。我需要在标头的 2 个地方写入客户端 IP,在 X-CLIENT-IP 和 X-FORWARDED-FOR 标签中。
问题是:当我使用
option http-server-close
option forwardfor
Run Code Online (Sandbox Code Playgroud)
在目标服务器上,我在标题 X-FORWARDED-FOR=xxx.xxx.xxx.xxx(client ip) 中看到但没有 x-client-ip 标题。
当我使用:
option forwardfor header X-Client-IP
option http-server-close
Run Code Online (Sandbox Code Playgroud)
在目标服务器上,我看到标头 X-CLIENT-IP=xxx.xxx.xxx(client IP) 但 X-FORWARDED-FOR=xxx.xxx.xxx.xxx(HAProxy ip)
我需要在目标标头上看到 X-CLIENT-IP 和 X-FORWARDED-FOR 具有客户端 IP 的值。
我尝试混合配置,如
option forwardfor
option forwardfor header X-Client-IP
option http-server-close
Run Code Online (Sandbox Code Playgroud)
没有效果。我也不能安装任何模块。目标是IIS。
有任何想法吗?:(
haproxy ×1