1. 程式人生 > >Node.js中,獲取req請求的原始IP

Node.js中,獲取req請求的原始IP

headers = {"x-real-ip":"127.0.0.1","x-forwarded-for":"127.0.0.1","host":"127.0.0.1","connection":"close","k2":"v2","k1":"v1","cache-control":"no-cache","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2687.0 Safari/537.36","postman-token":"17c79ae7-f00f-6d5f-279a-99d295cbf7d5","accept":"*/*","accept-encoding":"gzip, deflate, sdch","accept-language":"zh-CN,zh;q=0.8,en;q=0.6"}
x
-forwarded-for = 127.0.0.1 ips = ["127.0.0.1"] remoteAddress = ::ffff:127.0.0.1 ip = 127.0.0.1