Browse Source

fix endpoint matching

activeAddress
Matias Alejo Garcia 8 years ago
parent
commit
711f9516e5
No known key found for this signature in database GPG Key ID: 2470DB551277AB3
  1. 8
      lib/common/defaults.js
  2. 4
      lib/expressapp.js

8
lib/common/defaults.js

@ -93,10 +93,10 @@ Defaults.SESSION_EXPIRATION = 1 * 60 * 60; // 1 hour to session expiration
Defaults.RateLimit = {
createWallet: {
windowMs: 60 * 60 * 1000, // hour window
delayAfter: 5, // begin slowing down responses after the 3rd request
delayMs: 3 * 1000, // slow down subsequent responses by 3 seconds per request
max: 20, // start blocking after 20 requests
message: "Too many accounts created from this IP, please try again after an hour"
delayAfter: 10, // begin slowing down responses after the 3rd request
delayMs: 3000, // slow down subsequent responses by 3 seconds per request
max: 20, // start blocking after 20 request
message: "Too many wallets created from this IP, please try again after an hour"
},
// otherPosts: {
// windowMs: 60 * 60 * 1000, // 1 hour window

4
lib/expressapp.js

@ -175,8 +175,8 @@ ExpressApp.prototype.start = function(opts, cb) {
if (Defaults.RateLimit.createWallet) {
log.info('', 'Limiting wallet creation per IP: %d req/h', (Defaults.RateLimit.createWallet.max / Defaults.RateLimit.createWallet.windowMs * 60 * 60 * 1000).toFixed(2))
var createWalletLimiter = new RateLimit(Defaults.RateLimit.createWallet);
router.use('/v1/wallets/', createWalletLimiter)
router.use('/v2/wallets/', createWalletLimiter)
router.use(/\v1\/wallets\/$/, createWalletLimiter)
router.use(/\/v2\/wallets\/$/, createWalletLimiter)
}
// DEPRECATED

Loading…
Cancel
Save