I have a strapi app in which there is a collection called Page
and I want to limit the number of requests to /pages
. I know there is a rateLimit
middleware but how do i use it and change its default limit interval and max values.
Strapi Version: 4.5.1 Operating System: Windows 11 Database: postgres
You already know there is a middleware implemented, as to how to use it. You would add this middleware to the routes. As an example:
// path: ./src/api/restaurant/routes/restaurant.js
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::restaurant.restaurant', {
config: {
find: {
middlewares: [
// point to a registered middleware
'plugin::users-permissions.rateLimit ',
]
}
}
});