Skip to content

Commit ce921ba

Browse files
committed
added more tracking parameters to rate limiter
1 parent 51aa8a1 commit ce921ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

routes/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ router._enforceUserIdAndAppId = function(req,res,next){
6363

6464
// Log requests here
6565
router.use(function(req,res,next){
66-
var ipAddress = req.get('x-forwarded-for') || req.connection && req.connection.remoteAddress;
66+
var ipAddress = req.ip;
6767
req.requestId = fnv.hash(new Date().valueOf() + ipAddress, 128).str();
6868

6969
var reqLog = {
@@ -113,7 +113,7 @@ router.use(router._allRequestData);
113113
limiter({
114114
path: '*',
115115
method: 'all',
116-
lookup: ['userId','appId'],
116+
lookup: ['ip','userId','appId'],
117117
total: config.rateLimit * 1,
118118
expire: config.rateLimitExpiry * 1,
119119
onRateLimited: function (req, res, next) {

0 commit comments

Comments
 (0)