把浏览器访问该页面的url从原来的http://127.0.0.1:*改为http://192.1*(内网或公网IP)试试。
原文:
java.lang.String getRemoteHost()
Returns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address. For HTTP servlets, same as the value of the CGI variable REMOTE_HOST.
参考:http://www.coderhelper.top/doc/tomcat-9.0-doc/servletapi/index.html