diff options
-rw-r--r-- | modules/ip/ip.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/ip/ip.js b/modules/ip/ip.js index dec0a98..08fcf07 100644 --- a/modules/ip/ip.js +++ b/modules/ip/ip.js @@ -3,6 +3,8 @@ var cmn=require("../$common.js"), module.exports=function(app,io,moddir){ app.get("/ip",function(req,res){ - res.send(String(req.socket.remoteAddress)); + var ip=req.headers["x-forwarded-for"]; + if(ip)res.send(ip); + else res.send(String(req.socket.remoteAddress)); }); }; |