watsonQiu
V2EX  ›  Java

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

  •  
  •   watsonQiu · Oct 26, 2015 · 2467 views
    This topic created in 4033 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   ·   3701 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 09:56 · PVG 17:56 · LAX 01:56 · JFK 04:56
    ♥ Do have faith in what you're doing.