Last active
June 4, 2018 03:42
-
-
Save claustres/1647cfc258df5decf4469222320158f2 to your computer and use it in GitHub Desktop.
Rate limiting with FeathersJS - Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
host: process.env.HOSTNAME || 'localhost', | |
port: 8081, | |
// Global API limiter | |
apiLimiter: { | |
http: { | |
windowMs: 60*1000, // 1 minutes window | |
delayAfter: 30, // begin slowing down responses after the 30th request | |
delayMs: 1000, // slow down subsequent responses by 1 seconds per request | |
max: 60 // start blocking after 60 requests | |
}, | |
websocket: { | |
tokensPerInterval: 60, // start blocking after 60 requests | |
interval: 60*1000 // 1 minutes window | |
} | |
}, | |
authentication: { | |
secret: 'xxx', | |
strategies: [ | |
'jwt', | |
'local' | |
], | |
path: '/authentication', | |
// Authentication limiter | |
limiter: { | |
http: { | |
windowMs: 60*1000, // 1 minutes window | |
delayAfter: 5, // begin slowing down responses after the 5th request | |
delayMs: 3000, // slow down subsequent responses by 3 seconds per request | |
max: 10 // start blocking after 10 requests | |
}, | |
websocket: { | |
tokensPerInterval: 10, // start blocking after 10 requests | |
interval: 60*1000 // 1 minutes window | |
} | |
} | |
} | |
... | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment