JSPM

  • Created
  • Published
  • Downloads 8673
  • Score
    100M100P100Q135007F
  • License MIT

Rate limiting plugin for hapi

Package Exports

  • hapi-rate-limit

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hapi-rate-limit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hapi-rate-limit

This limits access to a given route three ways

userLimit: number of total requests a user can make per period pathLimit: number of total request any user can make on a given path per period userTimeout: length of period in seconds for userLimit pathTimeout: length of period in seconds for pathLimit

Default userLimit is 300 requests in 10 minutes Default pathLimit is 10 requests in 1 minute

both timeouts default to 10 minutes

Add this to route config to override path limit for that route:

  plugins: {
    'hapi-rate-limit': {
      pathLimit: 2,
      pathTimeout: 60000 // 1 minute
    }
  }

You can disable the userLimit or pathLimit for any given path with a route config like this:

  plugins: {
    'hapi-rate-limt': {
      pathLimit: false,
      userLimit: false
    }
  }