客户端系统主机名未使用request.getRemoteHost()获取

Client System Host Name is not captureing using request.getRemoteHost()

本文关键字:getRemoteHost 获取 request 未使用 客户端 端系统 主机 客户      更新时间:2023-09-26

我们在jsp页面中使用request.getRemoteHost()来获取客户端的主机名,但它只返回客户端系统的IP地址

是从java脚本、jsp、…中获取客户端系统主机名的任何其他方法吗,。。。

如果服务器的enableLookups(例如Tomcat)为false,则getRemoteHost()将只返回ip。最简单的解决方案是只更改属性并强制将ip解析为主机名。