From c8d88b2f5bb313fc7abc3c4b67b88a789af1abaf Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Fri, 2 Jun 2017 22:28:19 +1000 Subject: [PATCH] Change to req.ip --- index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index be6f94f..9f29cd3 100644 --- a/index.ts +++ b/index.ts @@ -12,9 +12,10 @@ var cache = new HashMap(); app.engine('handlebars', expresshb({ defaultLayout: 'main' })); app.set('view engine', 'handlebars'); +app.enable('trust-proxy'); app.get('/', function (req, res) { - getIpInfo("::ffff:" + "119.17.156.106").done(function (geoinfo: IPGeoJson) { + getIpInfo(req.ip).done(function (geoinfo: IPGeoJson) { res.render('home', { helpers: { ip: function () { return geoinfo.ip; },