watsonQiu
V2EX  ›  Java

有问题请教各位同仁, java 获取客户端真实 Ip 地址如何实现呢?

  •  
  •   watsonQiu · Oct 26, 2015 · 2456 views
    This topic created in 4027 days ago, the information mentioned may be changed or developed.

    百度上的 request.getRemoteAddr();只能获取到内网地址,并不是真实 IP 地址。。

    3 replies  •  2015-11-03 14:26:27 +08:00
    SoloCompany
    SoloCompany
    Oct 26, 2015
    1
    请 google RemoteIpValve
    只能帮你到这了
    smithtel
    smithtel
    Oct 29, 2015❤️1
    2
    String ip = request.getHeader("x-forwarded-for");
    watsonQiu
    watsonQiu
    OP
    Nov 3, 2015
    3
    @SoloCompany 谢谢,毕竟谷歌
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2875 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 13:18 · PVG 21:18 · LAX 05:18 · JFK 08:18
    ♥ Do have faith in what you're doing.