【问题标题】:Getting Client ip address without change software code在不更改软件代码的情况下获取客户端 IP 地址
【发布时间】:2022-01-12 10:50:06
【问题描述】:

我们在不同的机器上有 haproxy 和 websphere 来发布软件。软件尝试将客户端的 ip 插入数据库,但它会插入 haproxy 的 IP。程序员只使用这段代码,他们不会改变。

ipAddress = request.getRemoteAddr();

我得到了 tcpdump,我可以看到客户端的 ip 在 http 层的 x-forwarded-for 标记上。软件不使用这个标签来获取,我想。有没有办法将 x-forwarded-for 更改为 remoteaddress?有没有什么技巧可以在不更改软件代码的情况下获取客户的 ip?我应该在 websphere 服务器或 haproxy 层做什么?

Websphere 版本 8.5.5.11 haproxy 1.8 版

【问题讨论】:

    标签: websphere haproxy


    【解决方案1】:

    既然 websphere 是一个商业产品,我建议问问 IBM 应该在 websphere 中设置哪个参数。

    在 Internet 上进行的简短搜索显示了此页面 Potential WebSphere Application Server problems when deployed behind a WebSphere-aware proxy server从此页面链接HTTPServletRequest.getRemoteAddr/getRemoteHost starts to return WebSphere Plugin host value from 8.5.5.16 or 9.0.0.11.

    Tomcat 对此有 Remote IP Valve,我认为 websphere 也有类似的选项。

    我还强烈建议使用更新版本的 HAProxy,因为 1.8 即将结束直播https://www.haproxy.org/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-14
      • 2019-11-13
      • 1970-01-01
      • 2016-01-14
      • 2013-07-07
      • 2011-05-26
      • 1970-01-01
      • 2015-03-01
      相关资源
      最近更新 更多