Why request.getRemoteAddr() returns ipv4 or ipv6 depending on context (post query or ajax query)

前端 未结 3 872
鱼传尺愫
鱼传尺愫 2021-01-30 23:10

I\'ve donne a web app with Spring/GWT that uses Flash to upload files.

When I send an ajax request with GWT and try to get the user ip address, I get an ipv4 address lik

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 23:38

    You can fix it by starting your server with this flag

    -Djava.net.preferIPv4Stack=true
    

提交回复
热议问题