【问题标题】:Spring-Security getRemoteAddress for app behind proxy代理后面的应用程序的 Spring-Security getRemoteAddress
【发布时间】:2015-11-23 11:08:18
【问题描述】:

当应用程序位于代理(例如负载均衡器,apache httpd 服务器?目前 WebAuthenticationDetails 对象正在保存代理的 ip。我看到还有通过 X-FORWARDED-FOR 标头属性查找远程地址的解决方案。我是古玩是不提供这个的原因吗?

【问题讨论】:

    标签: spring-security proxy load-balancing reverse-proxy


    【解决方案1】:

    如果你使用Tomcat,你可以配置RemoteIpValve

    mod_remoteip 的 Tomcat 端口,此阀门将请求的明显客户端远程 IP 地址和主机名替换为代理或负载平衡器通过请求标头提供的 IP 地址列表(例如“X-Forwarded-For” )。

    【讨论】:

      猜你喜欢
      • 2014-12-19
      • 2011-08-21
      • 2020-04-04
      • 2013-09-24
      • 2017-08-27
      • 1970-01-01
      • 2015-07-16
      • 1970-01-01
      • 2022-11-16
      相关资源
      最近更新 更多