hbo*_*ert 3 haproxy x-forwarded-for apache-2.4
我已经配置了remoteip 并检查它是否确实已加载。Remoteip.conf 也会被加载。我通过在以下(正确的)配置中引入格式错误的 IP 来检查后者:
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1 10.10.0.1 10.10.0.2
Run Code Online (Sandbox Code Playgroud)
现在,当最终用户加载时,我可以验证是否看到X-Forwarded-For值为10.10.255.100的标头,这是正确的。然而REMOTE_ADDRPHP 中的变量仍然是负载均衡器的 IP。
根据关于这个主题的每个教程,此时应该可以正常工作。
RemoteIPTrustedProxy当最终用户在“内部”网络中拥有 IP(在本例中为10.20.255.100)时,这似乎不起作用。我不确定为什么 apache 开发者选择这种机制和策略的交织(在我看来这肯定是)。要接受内部网络 IP,请使用:
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1 10.10.0.1 10.10.0.2
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3496 次 |
| 最近记录: |