anyproxy 获取请求源ip时,https会取得127.0.0.1,访问http是正常的

zc0qhyus  于 2个月前  发布在  其他
关注(0)|答案(4)|浏览(53)

requestDetail._req.socket.remoteAddress 使用内网访问时会出现127.0.0.1,而外网没有问题。看到——req的_peername: { address: '::ffff:127.0.0.1', family: 'IPv6', port: 50939 }很疑惑,求解答

3pvhb19x

3pvhb19x1#

需要更正一下问题,这个问题查出来是https的情况下是获取不到的

nbysray5

nbysray52#

@KyleQiao1992
是指https情况下只能获取到127.0.0.1吗?

7vux5j2d

7vux5j2d3#

@codingfishman
是的,我这边测试了一下http情况没有问题正常课可以获取ip地址,https返回的是127.0.0.1

gywdnpxw

gywdnpxw4#

@codingfishman https://stackoverflow.com/questions/5999379/how-to-find-out-the-remote-address-in-node-js-if-it-is-https-request 我参考了这篇wiki,使用req.connection.socket.remoteAddress但是获取不到

相关问题