watsonQiu
V2EX  ›  Java

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

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

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

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