HttpServletRequest.getRemoteAddr() in Tomcat returns IPv6 formatted IP address

让人想犯罪 __ 提交于 2019-11-30 16:08:24

try adding this parameter -Djava.net.preferIPv4Stack=true to your tomcat startup commandline.

when you use localhost/xxx, your browser first have to find the mapped address for the name "localhost".In system host file you will find:

# 127.0.0.1 localhost

# ::1 localhost

both definition disabled by default.

to change browser's default matching rules, you have to enable the definition.

e.g: remove "#" from the first host file line, your brower will know directily "localhost" equals 127.0.0.1

Cheers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!